mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-13 21:00:06 +01:00
feat: sdk migration in progress
This commit is contained in:
12
ui/src/components/protected-route.tsx
Normal file
12
ui/src/components/protected-route.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import { useAuth } from "@/auth/use-auth.ts"
|
||||
import { Navigate, Outlet, useLocation } from "react-router-dom"
|
||||
|
||||
export const ProtectedRoute = () => {
|
||||
const { authed } = useAuth()
|
||||
const loc = useLocation()
|
||||
|
||||
if (!authed) {
|
||||
return <Navigate to={`/login?to=${encodeURIComponent(loc.pathname + loc.search)}`} replace />
|
||||
}
|
||||
return <Outlet />
|
||||
}
|
||||
Reference in New Issue
Block a user