fix: authorization / registration
This commit is contained in:
@@ -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 />
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user