🐛(app-impress) fix all the resources were public
All the resources were public. We now update correctly depend the user's choice. We add a test.
This commit is contained in:
@@ -25,6 +25,7 @@ export const CardCreatePad = () => {
|
||||
},
|
||||
});
|
||||
const [padName, setPadName] = useState('');
|
||||
const [padPublic, setPadPublic] = useState(false);
|
||||
const { colorsTokens } = useCunninghamTheme();
|
||||
|
||||
return (
|
||||
@@ -52,14 +53,18 @@ export const CardCreatePad = () => {
|
||||
label={t('Pad name')}
|
||||
{...{ error, isError, isPending, setPadName }}
|
||||
/>
|
||||
<Switch label={t('Is it public ?')} labelSide="right" />
|
||||
<Switch
|
||||
label={t('Is it public ?')}
|
||||
labelSide="right"
|
||||
onChange={() => setPadPublic(!padPublic)}
|
||||
/>
|
||||
</Box>
|
||||
<Box $justify="space-between" $direction="row" $align="center">
|
||||
<StyledLink href="/">
|
||||
<Button color="secondary">{t('Cancel')}</Button>
|
||||
</StyledLink>
|
||||
<Button
|
||||
onClick={() => createPad({ title: padName, is_public: true })}
|
||||
onClick={() => createPad({ title: padName, is_public: padPublic })}
|
||||
disabled={!padName}
|
||||
>
|
||||
{t('Create the pad')}
|
||||
|
||||
@@ -25,6 +25,7 @@ export const CardCreateTemplate = () => {
|
||||
},
|
||||
});
|
||||
const [templateName, setTemplateName] = useState('');
|
||||
const [templatePublic, setTemplatePublic] = useState(false);
|
||||
const { colorsTokens } = useCunninghamTheme();
|
||||
|
||||
return (
|
||||
@@ -52,7 +53,11 @@ export const CardCreateTemplate = () => {
|
||||
label={t('Template name')}
|
||||
{...{ error, isError, isPending, setTemplateName }}
|
||||
/>
|
||||
<Switch label={t('Is it public ?')} labelSide="right" />
|
||||
<Switch
|
||||
label={t('Is it public ?')}
|
||||
labelSide="right"
|
||||
onChange={() => setTemplatePublic(!templatePublic)}
|
||||
/>
|
||||
</Box>
|
||||
<Box $justify="space-between" $direction="row" $align="center">
|
||||
<StyledLink href="/">
|
||||
@@ -60,7 +65,7 @@ export const CardCreateTemplate = () => {
|
||||
</StyledLink>
|
||||
<Button
|
||||
onClick={() =>
|
||||
createTemplate({ title: templateName, is_public: true })
|
||||
createTemplate({ title: templateName, is_public: templatePublic })
|
||||
}
|
||||
disabled={!templateName}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user