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:00 +00:00
parent 965f28186f
commit 83ac37e4a1
2 changed files with 7 additions and 13 deletions

View file

@ -11,6 +11,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.error || `Request failed: ${res.status}`)