aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/client/components/ProtectedRoute.test.tsx
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-01-01 21:28:33 +0900
committernsfisis <nsfisis@gmail.com>2026-01-01 21:28:33 +0900
commit1d31f2ec8921bb58d74458b057bbb31f4877c335 (patch)
tree695e24534c9529d4271aa7ed544eaadb697c93b6 /src/client/components/ProtectedRoute.test.tsx
parentbf286c11d3244afb5132271dac656109934150e0 (diff)
downloadkioku-1d31f2ec8921bb58d74458b057bbb31f4877c335.tar.gz
kioku-1d31f2ec8921bb58d74458b057bbb31f4877c335.tar.zst
kioku-1d31f2ec8921bb58d74458b057bbb31f4877c335.zip
fix(auth): redirect to login when session expires
When the refresh token fails (session expired), the ApiClient now notifies the AuthProvider via a callback. This triggers a logout and React state update, causing ProtectedRoute to redirect to /login. Closes #7 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/client/components/ProtectedRoute.test.tsx')
-rw-r--r--src/client/components/ProtectedRoute.test.tsx1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/client/components/ProtectedRoute.test.tsx b/src/client/components/ProtectedRoute.test.tsx
index 85a12cd..25e73a3 100644
--- a/src/client/components/ProtectedRoute.test.tsx
+++ b/src/client/components/ProtectedRoute.test.tsx
@@ -15,6 +15,7 @@ vi.mock("../api/client", () => ({
logout: vi.fn(),
isAuthenticated: vi.fn(),
getTokens: vi.fn(),
+ onSessionExpired: vi.fn(() => vi.fn()),
},
ApiClientError: class ApiClientError extends Error {
constructor(