fixes and improvements

This commit is contained in:
Daniel
2023-07-12 16:34:05 -04:00
parent 0bcb8515a0
commit 7be3b37b21
6 changed files with 25 additions and 31 deletions
+10 -2
View File
@@ -20,14 +20,22 @@ export default function AuthRedirect({ children }: Props) {
if (!router.pathname.startsWith("/public")) {
if (
status === "authenticated" &&
(router.pathname === "/login" || router.pathname === "/register")
(router.pathname === "/login" ||
router.pathname === "/register" ||
router.pathname === "/confirmation" ||
router.pathname === "/forgot")
) {
router.push("/").then(() => {
setRedirect(false);
});
} else if (
status === "unauthenticated" &&
!(router.pathname === "/login" || router.pathname === "/register")
!(
router.pathname === "/login" ||
router.pathname === "/register" ||
router.pathname === "/confirmation" ||
router.pathname === "/forgot"
)
) {
router.push("/login").then(() => {
setRedirect(false);