fix: authorization / registration

This commit is contained in:
2026-05-10 19:24:32 +03:00
parent 574e27a379
commit 8b0e787fc6
11 changed files with 140 additions and 39 deletions

View File

@@ -3,12 +3,10 @@ import { useIsAuthenticated } from '@features/auth'
import { ROUTES } from '@shared/config/routes'
export function ProtectedRoute() {
const isAuthenticated = useIsAuthenticated()
const { isAuthenticated, isLoading } = useIsAuthenticated()
const location = useLocation()
if (!isAuthenticated) {
return <Navigate to={ROUTES.LOGIN} state={{ from: location }} replace />
}
if (isLoading) return null
if (!isAuthenticated) return <Navigate to={ROUTES.LOGIN} state={{ from: location }} replace />
return <Outlet />
}