Fix expired session showing EmbeddedFallback instead of login page
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
965f28186f
commit
83ac37e4a1
2 changed files with 7 additions and 13 deletions
|
|
@ -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}`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue