parent
81f3e824ff
commit
a5522c98a0
|
@ -57,10 +57,9 @@ function useRedirectToLoginIfUnauthenticated() {
|
|||
const { data: session, status } = useSession();
|
||||
const loading = status === "loading";
|
||||
const router = useRouter();
|
||||
const shouldDisplayUnauthed = router.pathname.startsWith("/apps");
|
||||
|
||||
useEffect(() => {
|
||||
if (shouldDisplayUnauthed) {
|
||||
if (router.pathname.startsWith("/apps")) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -77,7 +76,6 @@ function useRedirectToLoginIfUnauthenticated() {
|
|||
|
||||
return {
|
||||
loading: loading && !session,
|
||||
shouldDisplayUnauthed,
|
||||
session,
|
||||
};
|
||||
}
|
||||
|
@ -136,7 +134,7 @@ export default function Shell(props: {
|
|||
}) {
|
||||
const { t } = useLocale();
|
||||
const router = useRouter();
|
||||
const { loading, shouldDisplayUnauthed } = useRedirectToLoginIfUnauthenticated();
|
||||
const { loading, session } = useRedirectToLoginIfUnauthenticated();
|
||||
const { isRedirectingToOnboarding } = useRedirectToOnboardingIfNeeded();
|
||||
|
||||
const telemetry = useTelemetry();
|
||||
|
@ -209,7 +207,7 @@ export default function Shell(props: {
|
|||
);
|
||||
}
|
||||
|
||||
if (!shouldDisplayUnauthed) return null;
|
||||
if (!session) return null;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
Loading…
Reference in New Issue