Updated validations for websites.

This commit is contained in:
Mike Cao 2023-10-04 19:22:26 -07:00
parent 5c933d1c4a
commit 1325abe31d
3 changed files with 7 additions and 13 deletions

View File

@ -1,15 +1,9 @@
import WebsiteSettings from '../WebsiteSettings'; import WebsiteSettings from '../WebsiteSettings';
async function getDisabled() { export default async function WebsiteSettingsPage({ params: { id } }) {
return !!process.env.CLOUD_MODE; if (process.env.cloudMode) {
}
export default async function WebsiteSettingsPage({ params }) {
const disabled = await getDisabled();
if (!params.id || disabled) {
return null; return null;
} }
return <WebsiteSettings websiteId={params.id} />; return <WebsiteSettings websiteId={id} />;
} }

View File

@ -24,9 +24,9 @@ const schema = {
}), }),
POST: yup.object().shape({ POST: yup.object().shape({
id: yup.string().uuid().required(), id: yup.string().uuid().required(),
name: yup.string().required(), name: yup.string(),
domain: yup.string().required(), domain: yup.string(),
shareId: yup.string().matches(SHARE_ID_REGEX, { excludeEmptyString: true }), shareId: yup.string().matches(SHARE_ID_REGEX, { excludeEmptyString: true }).nullable(),
}), }),
}; };

View File

@ -24,7 +24,7 @@ const schema = {
POST: yup.object().shape({ POST: yup.object().shape({
name: yup.string().max(100).required(), name: yup.string().max(100).required(),
domain: yup.string().max(500).required(), domain: yup.string().max(500).required(),
shareId: yup.string().max(50), shareId: yup.string().max(50).nullable(),
}), }),
}; };