Check for valid urls.
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user