feat: add ignoreSessionCheck prop to AreaRiservataLayout for session handling flexibility
This commit is contained in:
parent
243148267b
commit
c3cdac8310
2 changed files with 31 additions and 28 deletions
|
|
@ -61,16 +61,18 @@ export const AreaRiservataLayout = ({
|
||||||
children,
|
children,
|
||||||
noSidebar,
|
noSidebar,
|
||||||
noFooter,
|
noFooter,
|
||||||
|
ignoreSessionCheck,
|
||||||
}: {
|
}: {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
noSidebar?: boolean;
|
noSidebar?: boolean;
|
||||||
noFooter?: boolean;
|
noFooter?: boolean;
|
||||||
|
ignoreSessionCheck?: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
const { data: bannerData } = api.settings.getBannerData.useQuery({
|
const { data: bannerData } = api.settings.getBannerData.useQuery({
|
||||||
area_riservata: true,
|
area_riservata: true,
|
||||||
});
|
});
|
||||||
const session = useSession();
|
const session = useSession();
|
||||||
|
if (!ignoreSessionCheck) {
|
||||||
if (session.status === "pending")
|
if (session.status === "pending")
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full min-h-screen flex-col text-clip">
|
<div className="flex h-full min-h-screen flex-col text-clip">
|
||||||
|
|
@ -99,6 +101,7 @@ export const AreaRiservataLayout = ({
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex h-full min-h-screen flex-col text-clip">
|
<div className="flex h-full min-h-screen flex-col text-clip">
|
||||||
|
|
@ -111,7 +114,7 @@ export const AreaRiservataLayout = ({
|
||||||
<main className="flex h-full flex-1 overflow-auto">
|
<main className="flex h-full flex-1 overflow-auto">
|
||||||
<div className="flex h-auto w-full flex-col md:flex-row">
|
<div className="flex h-auto w-full flex-col md:flex-row">
|
||||||
{noSidebar ? null : (
|
{noSidebar ? null : (
|
||||||
<Sidebar isAdmin={session.user.isAdmin || false} />
|
<Sidebar isAdmin={session.user?.isAdmin || false} />
|
||||||
)}
|
)}
|
||||||
<EnforcedSessionContext.Provider value={session as ValidSession}>
|
<EnforcedSessionContext.Provider value={session as ValidSession}>
|
||||||
{children}
|
{children}
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ const PreOnboardServizio: NextPageWithLayout<PreOnboardServizioProps> = ({
|
||||||
|
|
||||||
PreOnboardServizio.getLayout = function getLayout(page) {
|
PreOnboardServizio.getLayout = function getLayout(page) {
|
||||||
return (
|
return (
|
||||||
<AreaRiservataLayout noSidebar noFooter>
|
<AreaRiservataLayout noSidebar noFooter ignoreSessionCheck>
|
||||||
{page}
|
{page}
|
||||||
</AreaRiservataLayout>
|
</AreaRiservataLayout>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue