improve chat ui
All checks were successful
Build Container / Build Container (push) Successful in 1m29s

This commit is contained in:
kritzl 2026-05-18 16:49:24 +02:00
commit 81923c4f8c
Signed by: kritzl
SSH key fingerprint: SHA256:5BmINP9VjZWaUk5Z+2CTut1KFhwLtd0ZynMekKbtViM
7 changed files with 170 additions and 48 deletions

View file

@ -1,5 +1,6 @@
import {Fetcher} from "openapi-typescript-fetch"
import type {paths} from "../api/schema"
import type {ui} from "../i18n/ui.ts"
const fetcher = Fetcher.for<paths>()
@ -25,7 +26,7 @@ export type AuthType = {
declare global {
interface Window {
lang: string;
lang: keyof typeof ui;
doors: Array<DoorType>;
auth: AuthType;
doorAction: (action: 'unlock' | 'lock', doorId: string) => void;
@ -160,6 +161,9 @@ async function fetchDoors() {
jammed: door.status.is_error_jammed,
})
})
loading.doors = false
refresh()
} catch (e) {
// check which operation threw the exception
if (e instanceof getDoors.Error) {
@ -167,6 +171,8 @@ async function fetchDoors() {
if (error.status === 401) {
console.log("unauthorized")
loading.doors = false
refresh()
} else if (error.status >= 500 && error.status < 600) {
apiError.current = "serverError"
clearInterval(doorsInterval)
@ -181,9 +187,6 @@ async function fetchDoors() {
apiError.current = "networkError"
}
}
} finally {
loading.doors = false
refresh()
}
}