Fix Authentication

This commit is contained in:
2022-05-26 11:38:45 +07:00
parent d2ebf09e48
commit 12c298b9a0
4 changed files with 24 additions and 16 deletions

View File

@@ -26,7 +26,7 @@ export default function AuthGuard({ children }: AuthGuardProps) {
if (pathname !== requestedLocation) {
setRequestedLocation(pathname);
}
return <Login />;
return <Navigate to="/auth/login" replace={true}/>;
}
if (requestedLocation && pathname !== requestedLocation) {

View File

@@ -15,7 +15,7 @@ export default function GuestGuard({ children }: GuestGuardProps) {
const { isAuthenticated } = useAuth();
if (isAuthenticated) {
return <Navigate to={'/dashboard'} />;
return <Navigate to={'/dashboard'} replace={true}/>;
}
return <>{children}</>;