reworked the chat layout and fixed a rate limiting mistake

This commit is contained in:
2025-12-28 20:29:13 +01:00
parent 3633b6594c
commit dd293c8e3d
11 changed files with 424 additions and 261 deletions

View File

@@ -1,5 +1,6 @@
import { initAuth } from '../stores/auth.ts'
import { initAuth, logout } from '../stores/auth.ts'
import { API } from '../main.ts'
import router from '../router'
export async function apiFetch<T>(
path: string,
@@ -16,6 +17,12 @@ export async function apiFetch<T>(
},
})
if (res.status === 401) {
await logout()
router.push('/login')
throw new Error("Session expired")
}
if (!res.ok) {
const text = await res.text()
throw new Error(text || res.statusText)
@@ -23,4 +30,3 @@ export async function apiFetch<T>(
return res.json()
}