From 9d5404e0d3f64d96231b3a6d1b875171d1c04298 Mon Sep 17 00:00:00 2001 From: Ellie Re'em Date: Tue, 24 Dec 2024 18:30:22 +0000 Subject: [PATCH] Fix: conversations is not a publicHead and fix auth redirect to not clear history --- guards/AuthGuard.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/guards/AuthGuard.tsx b/guards/AuthGuard.tsx index e19863813..ae93ae9b3 100644 --- a/guards/AuthGuard.tsx +++ b/guards/AuthGuard.tsx @@ -78,7 +78,6 @@ export function AuthGuard({ children }: { children: JSX.Element }) { if ( publicPathHeads.includes(pathHead) || partiallyPublicPages.includes(router.asPath) || - router.asPath.includes('/conversations') || router.asPath.includes('/shorts') ) { return <>{children}; @@ -86,7 +85,7 @@ export function AuthGuard({ children }: { children: JSX.Element }) { // Page requires authenticated user if (unauthenticated && typeof window !== 'undefined') { - router.push(`/auth/login${generateReturnUrlQuery(router.asPath)}`); + router.replace(`/auth/login${generateReturnUrlQuery(router.asPath)}`); } if (userId) {