From d0325c13d1c32f57f770fbc4447c8bbdcbfa86d5 Mon Sep 17 00:00:00 2001 From: sean-brydon <55134778+sean-brydon@users.noreply.github.com> Date: Wed, 6 Jul 2022 15:47:22 +0100 Subject: [PATCH] Split on slug to get profile page (#3228) * Split on slug to get profile page * Fix teams slug * Remove console.log * Remove unneeded diff --- apps/web/components/booking/pages/AvailabilityPage.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/web/components/booking/pages/AvailabilityPage.tsx b/apps/web/components/booking/pages/AvailabilityPage.tsx index 50c3dcf096..fbbab0aa89 100644 --- a/apps/web/components/booking/pages/AvailabilityPage.tsx +++ b/apps/web/components/booking/pages/AvailabilityPage.tsx @@ -88,8 +88,12 @@ export const locationKeyToString = (location: LocationObject, t: TFunction) => { } }; -const GoBackToPreviousPage = ({ slug, t }: { slug: string; t: TFunction }) => { +const GoBackToPreviousPage = ({ t }: { t: TFunction }) => { const router = useRouter(); + const path = router.asPath.split("/"); + path.pop(); // Remove the last item (where we currently are) + path.shift(); // Removes first item e.g. if we were visitng "/teams/test/30mins" the array will new look like ["teams","test"] + const slug = path.join("/"); return (
- + {/* Temporarily disabled - booking?.startTime && rescheduleUid && (