Check for valid urls.

This commit is contained in:
Mike Cao 2025-02-10 21:52:30 -08:00
parent 6466cef269
commit e2523d2604
2 changed files with 19 additions and 4 deletions

View file

@ -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',