diff --git a/web/src/components/AutoDivinationPage.tsx b/web/src/components/AutoDivinationPage.tsx index 3fd8abb..2f6a95a 100644 --- a/web/src/components/AutoDivinationPage.tsx +++ b/web/src/components/AutoDivinationPage.tsx @@ -422,6 +422,10 @@ export default function AutoDivinationPage({ locale, divination: d }: Props) { const handleSubmit = () => { if (!done) return; + if (!question.trim()) { + setErrorMessage(locale === 'en' ? 'Please enter your question before starting the interpretation.' : '请输入您要占卜的问题后再开始解卦。'); + return; + } setShowConfirm(true); }; diff --git a/web/src/components/ManualDivinationPage.tsx b/web/src/components/ManualDivinationPage.tsx index b54e571..119e35d 100644 --- a/web/src/components/ManualDivinationPage.tsx +++ b/web/src/components/ManualDivinationPage.tsx @@ -440,6 +440,10 @@ export default function ManualDivinationPage({ locale, divination: d }: Props) { const showNextGuide = () => setGuideStep((step) => (step === null ? 0 : Math.min(step + 1, text.guideSteps.length - 1))); const handleSubmit = () => { + if (!question.trim()) { + setErrorMessage(locale === 'en' ? 'Please enter your question before starting the interpretation.' : '请输入您要占卜的问题后再开始解卦。'); + return; + } setShowConfirm(true); }; diff --git a/web/src/components/SettingsPage.tsx b/web/src/components/SettingsPage.tsx index 07c0c54..2334ca5 100644 --- a/web/src/components/SettingsPage.tsx +++ b/web/src/components/SettingsPage.tsx @@ -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(); };