Skip to content

Commit

Permalink
Fix domains page
Browse files Browse the repository at this point in the history
  • Loading branch information
N2D4 committed Dec 11, 2024
1 parent 9a303bf commit 844056f
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function EditDialog(props: {
addWww: yup.boolean(),
});

const canAddWww = (domain: string) => isValidUrl('https://' + domain) && !domain.startsWith('www.') && isValidUrl('https://www.' + domain);
const canAddWww = (domain: string | undefined) => domain && isValidUrl('https://' + domain) && !domain.startsWith('www.') && isValidUrl('https://www.' + domain);

return <FormDialog
open={props.open}
Expand Down Expand Up @@ -107,7 +107,7 @@ function EditDialog(props: {
/>

{props.type === 'create' &&
canAddWww(form.watch('domain') as string) && (
canAddWww(form.watch('domain')) && (
<SwitchField
label={`Also add www.${form.watch('domain') as any ?? ''} as a trusted domain`}
name="addWww"
Expand Down

0 comments on commit 844056f

Please sign in to comment.