small fix
This commit is contained in:
parent
debfd36eb8
commit
1bd3001b95
|
@ -18,57 +18,57 @@ export default function AuthRedirect({ children }: Props) {
|
||||||
|
|
||||||
useInitialData();
|
useInitialData();
|
||||||
|
|
||||||
// useEffect(() => {
|
useEffect(() => {
|
||||||
// if (!router.pathname.startsWith("/public")) {
|
if (!router.pathname.startsWith("/public")) {
|
||||||
// if (
|
if (
|
||||||
// emailEnabled &&
|
emailEnabled &&
|
||||||
// status === "authenticated" &&
|
status === "authenticated" &&
|
||||||
// (data.user.isSubscriber === true ||
|
(data.user.isSubscriber === true ||
|
||||||
// data.user.isSubscriber === undefined) &&
|
data.user.isSubscriber === undefined) &&
|
||||||
// !data.user.username
|
!data.user.username
|
||||||
// ) {
|
) {
|
||||||
// router.push("/choose-username").then(() => {
|
router.push("/choose-username").then(() => {
|
||||||
// setRedirect(false);
|
setRedirect(false);
|
||||||
// });
|
});
|
||||||
// } else if (
|
} else if (
|
||||||
// status === "authenticated" &&
|
status === "authenticated" &&
|
||||||
// data.user.isSubscriber === false
|
data.user.isSubscriber === false
|
||||||
// ) {
|
) {
|
||||||
// router.push("/subscribe").then(() => {
|
router.push("/subscribe").then(() => {
|
||||||
// setRedirect(false);
|
setRedirect(false);
|
||||||
// });
|
});
|
||||||
// } else if (
|
} else if (
|
||||||
// status === "authenticated" &&
|
status === "authenticated" &&
|
||||||
// (router.pathname === "/login" ||
|
(router.pathname === "/login" ||
|
||||||
// router.pathname === "/register" ||
|
router.pathname === "/register" ||
|
||||||
// router.pathname === "/confirmation" ||
|
router.pathname === "/confirmation" ||
|
||||||
// router.pathname === "/subscribe" ||
|
router.pathname === "/subscribe" ||
|
||||||
// router.pathname === "/choose-username" ||
|
router.pathname === "/choose-username" ||
|
||||||
// router.pathname === "/forgot")
|
router.pathname === "/forgot")
|
||||||
// ) {
|
) {
|
||||||
// router.push("/").then(() => {
|
router.push("/").then(() => {
|
||||||
// setRedirect(false);
|
setRedirect(false);
|
||||||
// });
|
});
|
||||||
// } else if (
|
} else if (
|
||||||
// status === "unauthenticated" &&
|
status === "unauthenticated" &&
|
||||||
// !(
|
!(
|
||||||
// router.pathname === "/login" ||
|
router.pathname === "/login" ||
|
||||||
// router.pathname === "/register" ||
|
router.pathname === "/register" ||
|
||||||
// router.pathname === "/confirmation" ||
|
router.pathname === "/confirmation" ||
|
||||||
// router.pathname === "/forgot"
|
router.pathname === "/forgot"
|
||||||
// )
|
)
|
||||||
// ) {
|
) {
|
||||||
// router.push("/login").then(() => {
|
router.push("/login").then(() => {
|
||||||
// setRedirect(false);
|
setRedirect(false);
|
||||||
// });
|
});
|
||||||
// } else if (status === "loading") setRedirect(true);
|
} else if (status === "loading") setRedirect(true);
|
||||||
// else setRedirect(false);
|
else setRedirect(false);
|
||||||
// } else {
|
} else {
|
||||||
// setRedirect(false);
|
setRedirect(false);
|
||||||
// }
|
}
|
||||||
// }, [status]);
|
}, [status]);
|
||||||
|
|
||||||
// if (status !== "loading" && !redirect) return <>{children}</>;
|
if (status !== "loading" && !redirect) return <>{children}</>;
|
||||||
// else return <></>;
|
else return <></>;
|
||||||
return <>{children}</>;
|
// return <>{children}</>;
|
||||||
}
|
}
|
||||||
|
|
Ŝarĝante…
Reference in New Issue