From 1792d8c17289709a623b134a7b81c3608bbb39bf Mon Sep 17 00:00:00 2001 From: Udit Takkar Date: Tue, 31 Oct 2023 12:00:14 +0530 Subject: [PATCH] fix: link input --- apps/web/pages/event-types/[type]/index.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/web/pages/event-types/[type]/index.tsx b/apps/web/pages/event-types/[type]/index.tsx index f2f22d1eee..7265457c6f 100644 --- a/apps/web/pages/event-types/[type]/index.tsx +++ b/apps/web/pages/event-types/[type]/index.tsx @@ -341,7 +341,7 @@ const EventTypePage = (props: EventTypeSetupProps) => { const sampleUrl = eventLocationType.organizerInputPlaceholder; ctx.addIssue({ code: z.ZodIssueCode.custom, - path: [eventLocationType.defaultValueVariable], + path: [eventLocationType?.defaultValueVariable ?? "link"], message: `Invalid URL for ${eventLocationType.label}. ${ sampleUrl ? `Sample URL: ${sampleUrl}` : "" }`, @@ -350,11 +350,12 @@ const EventTypePage = (props: EventTypeSetupProps) => { return; } - const valid = z.string().url().optional().safeParse(val).success; + const valid = z.string().url().optional().safeParse(link).success; + if (!valid) { ctx.addIssue({ code: z.ZodIssueCode.custom, - path: [eventLocationType.defaultValueVariable], + path: [eventLocationType?.defaultValueVariable ?? "link"], message: `Invalid URL`, }); }