From c3cdac831017431b8e2c8fa307ced8f5529e17fc Mon Sep 17 00:00:00 2001 From: Marco Pedone Date: Sun, 24 Aug 2025 19:59:59 +0200 Subject: [PATCH] feat: add ignoreSessionCheck prop to AreaRiservataLayout for session handling flexibility --- apps/infoalloggi/src/components/Layout.tsx | 57 ++++++++++--------- .../servizio/pre-onboard/[servizioId].tsx | 2 +- 2 files changed, 31 insertions(+), 28 deletions(-) diff --git a/apps/infoalloggi/src/components/Layout.tsx b/apps/infoalloggi/src/components/Layout.tsx index a2c8180..b1a8ef9 100644 --- a/apps/infoalloggi/src/components/Layout.tsx +++ b/apps/infoalloggi/src/components/Layout.tsx @@ -61,43 +61,46 @@ export const AreaRiservataLayout = ({ children, noSidebar, noFooter, + ignoreSessionCheck, }: { children: ReactNode; noSidebar?: boolean; noFooter?: boolean; + ignoreSessionCheck?: boolean; }) => { const { data: bannerData } = api.settings.getBannerData.useQuery({ area_riservata: true, }); const session = useSession(); + if (!ignoreSessionCheck) { + if (session.status === "pending") + return ( +
+ - if (session.status === "pending") - return ( -
- +
+
+ ; +
+
+ {!noFooter && } +
+ ); + if (session.status !== "success" || !session.user) { + window.location.reload(); + return ( +
+ -
-
- ; -
-
- {!noFooter && } -
- ); - if (session.status !== "success" || !session.user) { - window.location.reload(); - return ( -
- - -
-
- ; -
-
- {!noFooter && } -
- ); +
+
+ ; +
+
+ {!noFooter && } +
+ ); + } } return ( @@ -111,7 +114,7 @@ export const AreaRiservataLayout = ({
{noSidebar ? null : ( - + )} {children} diff --git a/apps/infoalloggi/src/pages/servizio/pre-onboard/[servizioId].tsx b/apps/infoalloggi/src/pages/servizio/pre-onboard/[servizioId].tsx index 232f97e..516d79b 100644 --- a/apps/infoalloggi/src/pages/servizio/pre-onboard/[servizioId].tsx +++ b/apps/infoalloggi/src/pages/servizio/pre-onboard/[servizioId].tsx @@ -91,7 +91,7 @@ const PreOnboardServizio: NextPageWithLayout = ({ PreOnboardServizio.getLayout = function getLayout(page) { return ( - + {page} );