mirror of
https://github.com/umami-software/umami.git
synced 2026-02-16 18:45:36 +01:00
More yup validations.
This commit is contained in:
parent
2ccb8d0a3c
commit
ce2a83a09f
12 changed files with 99 additions and 50 deletions
|
|
@ -22,6 +22,12 @@ const schema = {
|
|||
GET: yup.object().shape({
|
||||
id: yup.string().uuid().required(),
|
||||
}),
|
||||
POST: yup.object().shape({
|
||||
id: yup.string().uuid().required(),
|
||||
name: yup.string().required(),
|
||||
domain: yup.string().required(),
|
||||
shareId: yup.string().matches(SHARE_ID_REGEX, { excludeEmptyString: true }),
|
||||
}),
|
||||
};
|
||||
|
||||
export default async (
|
||||
|
|
@ -55,10 +61,6 @@ export default async (
|
|||
|
||||
let website;
|
||||
|
||||
if (shareId && !shareId.match(SHARE_ID_REGEX)) {
|
||||
return serverError(res, 'Invalid share ID.');
|
||||
}
|
||||
|
||||
try {
|
||||
website = await updateWebsite(websiteId, { name, domain, shareId });
|
||||
} catch (e: any) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue