From 1d31f2ec8921bb58d74458b057bbb31f4877c335 Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Thu, 1 Jan 2026 21:28:33 +0900
Subject: fix(auth): redirect to login when session expires
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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>
---
 src/client/pages/StudyPage.test.tsx | 1 +
 1 file changed, 1 insertion(+)

(limited to 'src/client/pages/StudyPage.test.tsx')

diff --git a/src/client/pages/StudyPage.test.tsx b/src/client/pages/StudyPage.test.tsx
index 146322a..bc87b9d 100644
--- a/src/client/pages/StudyPage.test.tsx
+++ b/src/client/pages/StudyPage.test.tsx
@@ -17,6 +17,7 @@ vi.mock("../api/client", () => ({
 		isAuthenticated: vi.fn(),
 		getTokens: vi.fn(),
 		getAuthHeader: vi.fn(),
+		onSessionExpired: vi.fn(() => vi.fn()),
 		rpc: {
 			api: {
 				decks: {
-- 
cgit v1.2.3-70-g09d2

