fix(web): validate question input before divination and fix logout flow

- Add validation for question text in ManualDivinationPage and AutoDivinationPage
- Fix logout flow to call backend API before clearing local auth
- Show error message when question is empty before starting interpretation
This commit is contained in:
zl-q
2026-05-11 20:07:36 +08:00
parent 3cc5999383
commit 2b8984edbc
3 changed files with 15 additions and 4 deletions
+7 -4
View File
@@ -21,11 +21,14 @@ export default function SettingsPage({ locale, settings: s }: Props) {
if (!confirm(s.logoutConfirm)) return;
setLogoutLoading(true);
// Clear local auth immediately and redirect
try {
// Call backend logout first (needs auth)
await logout();
} catch {
// Ignore logout API errors
}
// Clear local auth and redirect
clearAuth();
// Fire backend logout in background (don't wait)
logout().catch(() => {});
// Redirect to login
redirectToLogin();
};