Make absolute URL and consider if its a team event or non team event (#3047)
Co-authored-by: Peer Richelsen <peeroke@gmail.com>pull/3049/head^2
parent
5c3d399ccb
commit
624a7a036d
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue