From 624a7a036da8743240b102bba885b6faa5875906 Mon Sep 17 00:00:00 2001 From: Hariom Balhara Date: Mon, 13 Jun 2022 17:48:51 +0530 Subject: [PATCH] Make absolute URL and consider if its a team event or non team event (#3047) Co-authored-by: Peer Richelsen --- apps/web/pages/cancel/success.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/web/pages/cancel/success.tsx b/apps/web/pages/cancel/success.tsx index aac0e15559..34c7d47be5 100644 --- a/apps/web/pages/cancel/success.tsx +++ b/apps/web/pages/cancel/success.tsx @@ -13,8 +13,17 @@ export default function CancelSuccess() { // Get router variables const router = useRouter(); const { title, name, eventPage, recurring } = router.query; + let team: string | string[] | number | undefined = router.query.team; const { data: session, status } = useSession(); const loading = status === "loading"; + // If team param passed wrongly just assume it be a non team case. + if (team instanceof Array || typeof team === "undefined") { + team = 0; + } + const isTeamEvent = +team === 1; + // FIXME: In case of Dynamic Event Booking, it takes the booker to one of the user's page(e.g. A) in the dynamic group(A+B+...). Booker should be taken to the same dynamic group + // This isn't directly possible because a booking doesn't know if it was done for a Dynamic Event(booking.eventType is null) + const eventUrl = `/${isTeamEvent ? "team/" : ""}${eventPage as string}`; return (
- {!loading && !session?.user && } + {!loading && !session?.user && } {!loading && session?.user && (