fix: authorization / registration
This commit is contained in:
11
src/app/providers/GuestRoute.tsx
Normal file
11
src/app/providers/GuestRoute.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import { Navigate, Outlet } from 'react-router-dom'
|
||||
import { useIsAuthenticated } from '@features/auth'
|
||||
import { ROUTES } from '@shared/config/routes'
|
||||
|
||||
export function GuestRoute() {
|
||||
const { isAuthenticated, isLoading } = useIsAuthenticated()
|
||||
|
||||
if (isLoading) return null
|
||||
if (isAuthenticated) return <Navigate to={ROUTES.WALLET} replace />
|
||||
return <Outlet />
|
||||
}
|
||||
Reference in New Issue
Block a user