| 13 | } |
| 14 | |
| 15 | export async function getStatus(): Promise<AuthStatus> { |
| 16 | const res = await fetch('/api/auth/status', { credentials: 'same-origin' }) |
| 17 | if (!res.ok) { |
| 18 | // If the backend can't even serve /status, treat as "auth required" |
| 19 | // pessimistically — better than locking the user out of the login page. |
| 20 | return { authed: false, tokenConfigured: true } |
| 21 | } |
| 22 | return res.json() |
| 23 | } |
| 24 | |
| 25 | export async function login(token: string): Promise<{ ok: boolean; error?: string }> { |
| 26 | const res = await fetch('/api/auth/login', { |