diff --git a/src/app/providers/ProtectedRoute.tsx b/src/app/providers/ProtectedRoute.tsx
new file mode 100644
index 0000000..f3e020b
--- /dev/null
+++ b/src/app/providers/ProtectedRoute.tsx
@@ -0,0 +1,14 @@
+import { Navigate, Outlet, useLocation } from 'react-router-dom'
+import { useIsAuthenticated } from '@features/auth'
+import { ROUTES } from '@shared/config/routes'
+
+export function ProtectedRoute() {
+ const isAuthenticated = useIsAuthenticated()
+ const location = useLocation()
+
+ if (!isAuthenticated) {
+ return
+ }
+
+ return
+}
diff --git a/src/app/providers/RouterProvider.tsx b/src/app/providers/RouterProvider.tsx
index 1eab5f7..7025d3d 100644
--- a/src/app/providers/RouterProvider.tsx
+++ b/src/app/providers/RouterProvider.tsx
@@ -8,6 +8,7 @@ import { RegisterPage } from '@pages/register'
import { SeedPhrasePage } from '@pages/seed-phrase'
import { ROUTES } from '@shared/config/routes'
import { ScrollToTop } from './ScrollToTop'
+import { ProtectedRoute } from './ProtectedRoute'
export function RouterProvider() {
return (
@@ -15,12 +16,15 @@ export function RouterProvider() {
} />
- } />
- } />
- } />
} />
} />
- } />
+
+ }>
+ } />
+ } />
+ } />
+ } />
+
)
diff --git a/src/features/auth/api/registrationApi.ts b/src/features/auth/api/registrationApi.ts
index d1d1d84..160187c 100644
--- a/src/features/auth/api/registrationApi.ts
+++ b/src/features/auth/api/registrationApi.ts
@@ -1,4 +1,5 @@
import { api } from '@shared/api/base'
+import { getCsrfToken } from '@shared/api/csrf'
export interface RegistrationStartPayload {
email: string
@@ -19,6 +20,7 @@ export function registrationComplete(payload: RegistrationCompletePayload): Prom
return api.post('/auth/registration/complete', payload)
}
-export function logout(): Promise {
- return api.post('/logout', {})
+export async function logout(): Promise {
+ const csrfToken = await getCsrfToken()
+ return api.post('/logout', { _csrf: csrfToken })
}