Skip to content

Scheduling infrastructure for absolutely everyone.

Make absolute URL and consider if its a team event or non team event (#3047)

Hariom Balhara624a7a036da8
diff --git a/apps/web/pages/cancel/success.tsx b/apps/web/pages/cancel/success.tsx
index aac0e15559c..34c7d47be51 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 (
<div>
<HeadSeo
@@ -50,7 +59,7 @@ export default function CancelSuccess() {
</div>
<div className="mt-5 text-center sm:mt-6">
<div className="mt-5">
- {!loading && !session?.user && <Button href={eventPage as string}>Pick another</Button>}
+ {!loading && !session?.user && <Button href={eventUrl}>Pick another</Button>}
{!loading && session?.user && (
<Button
data-testid="back-to-bookings"