mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 06:07:17 +01:00
Check for valid urls.
This commit is contained in:
parent
6466cef269
commit
e2523d2604
2 changed files with 19 additions and 4 deletions
|
|
@ -36,6 +36,20 @@ export const unitParam = z.string().refine(value => UNIT_TYPES.includes(value),
|
|||
|
||||
export const roleParam = z.enum(['team-member', 'team-view-only', 'team-manager']);
|
||||
|
||||
export const urlOrPathParam = z.string().refine(
|
||||
value => {
|
||||
try {
|
||||
new URL(value, 'https://localhost');
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
{
|
||||
message: 'Invalid URL.',
|
||||
},
|
||||
);
|
||||
|
||||
export const reportTypeParam = z.enum([
|
||||
'funnel',
|
||||
'insights',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue