Fix expired session showing EmbeddedFallback instead of login page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-10 11:44:01 +00:00
parent 0511ac8d82
commit 803332e6a3
2 changed files with 7 additions and 13 deletions

View file

@ -8,6 +8,10 @@ async function request<T>(path: string, opts: RequestInit = {}): Promise<T> {
headers: { 'Content-Type': 'application/json', ...opts.headers },
...opts,
})
if (res.status === 401) {
;(window.top ?? window).location.href = '/login'
throw new Error('Unauthenticated')
}
if (!res.ok) {
const err = await res.json().catch(() => ({ error: res.statusText }))
throw new Error((err as { error?: string }).error || `Request failed: ${res.status}`)