This commit is contained in:
@@ -18,6 +18,7 @@ type Task = { id: string; list_id: string; parent_id: string | null; title: stri
|
||||
type View = 'tasks' | 'today' | 'upcoming' | 'trash' | 'habits' | 'calendar' | 'settings'
|
||||
|
||||
const initialized = ref<boolean | null>(null)
|
||||
const authReady = ref(false)
|
||||
const authenticated = ref(false)
|
||||
const username = ref('')
|
||||
const password = ref('')
|
||||
@@ -111,6 +112,7 @@ function toast(message: string) {
|
||||
function fail(reason: unknown) { error.value = reason instanceof Error ? reason.message : '请求失败' }
|
||||
|
||||
async function bootstrap() {
|
||||
authReady.value = false
|
||||
try {
|
||||
const status = await api('/setup/status')
|
||||
initialized.value = status.initialized
|
||||
@@ -125,7 +127,12 @@ async function bootstrap() {
|
||||
expandedFolders.value = new Set(folders.value.map((folder) => folder.id))
|
||||
await loadAll()
|
||||
}
|
||||
} catch { authenticated.value = false; initialized.value ??= true }
|
||||
} catch {
|
||||
authenticated.value = false
|
||||
initialized.value ??= true
|
||||
} finally {
|
||||
authReady.value = true
|
||||
}
|
||||
}
|
||||
async function submitAuth() {
|
||||
error.value = ''
|
||||
@@ -382,7 +389,7 @@ onMounted(bootstrap)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="initialized === null" class="center"><span class="loader" />正在打开 dodo…</div>
|
||||
<div v-if="!authReady" class="center"><span class="loader" />正在打开 dodo…</div>
|
||||
<div v-else-if="!authenticated" class="auth-shell">
|
||||
<section class="auth-card">
|
||||
<div class="brand">do<span>do</span></div><p>{{ initialized ? '欢迎回来,继续把生活理顺。' : '创建你的 dodo' }}</p>
|
||||
|
||||
Reference in New Issue
Block a user