T-011: UI-Fix — Fehler nicht mehr in Ladeansicht versteckt, 'Lade Bibliothek...'-Zustand, Startfehler führt zum Login-Screen
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
type View = 'loading' | 'login' | 'library'
|
||||
|
||||
let view = $state<View>('loading')
|
||||
let loadingMsg = $state<string>('Prüfe Anmeldung…')
|
||||
let error = $state('')
|
||||
let info = $state('')
|
||||
let books = $state<Book[]>([])
|
||||
@ -25,9 +26,13 @@
|
||||
books = await getLibrary()
|
||||
view = 'library'
|
||||
} catch (e) {
|
||||
// Fehler sichtbar machen, nicht in der Lade-Ansicht hängen
|
||||
error = String(e)
|
||||
view = 'library'
|
||||
books = []
|
||||
} finally {
|
||||
checking = false
|
||||
loadingMsg = 'Prüfe Anmeldung…'
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,11 +43,15 @@
|
||||
const s = await authStatus()
|
||||
if (s.logged_in) {
|
||||
clearPoll()
|
||||
loadingMsg = 'Lade Bibliothek…'
|
||||
await loadLibrary()
|
||||
} else if (view === 'library') {
|
||||
view = 'login'
|
||||
} else {
|
||||
view = 'login'
|
||||
}
|
||||
} catch (e) {
|
||||
view = 'login'
|
||||
error = String(e)
|
||||
} finally {
|
||||
checking = false
|
||||
@ -75,7 +84,8 @@
|
||||
{#if view === 'loading'}
|
||||
<main class="center">
|
||||
<h1>Hörwerk</h1>
|
||||
<p class="muted">Prüfe Anmeldung…</p>
|
||||
<p class="muted">{loadingMsg}</p>
|
||||
{#if error}<p class="error">{error}</p>{/if}
|
||||
</main>
|
||||
{:else if view === 'login'}
|
||||
<main class="center">
|
||||
|
||||
Reference in New Issue
Block a user