deploy 1
This commit is contained in:
18
src/routes/_authenticated/route.tsx
Normal file
18
src/routes/_authenticated/route.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
import { createFileRoute, redirect } from '@tanstack/react-router'
|
||||
import { AuthenticatedLayout } from '@/components/layout/authenticated-layout'
|
||||
import { useAuthStore } from '@/stores/auth-store'
|
||||
|
||||
export const Route = createFileRoute('/_authenticated')({
|
||||
beforeLoad: ({ location }) => {
|
||||
const { accessToken } = useAuthStore.getState().auth
|
||||
if (!accessToken) {
|
||||
throw redirect({
|
||||
to: '/sign-in',
|
||||
search: {
|
||||
redirect: location.href,
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
component: AuthenticatedLayout,
|
||||
})
|
||||
Reference in New Issue
Block a user