diff --git a/src/App.vue b/src/App.vue index e78a239..e6503cb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1779,13 +1779,20 @@ function submitCapture(e) { return res.json() }) .then(data => { - if (!data || !data.report_id || !data.report_token) { + // The HTTP res.ok check above already confirmed the worker accepted + // the submission (email sent). report_id/report_token are only + // returned by the D1-backed worker; capture them when present so the + // email restore link works, but don't require them — the storage-free + // worker sends the plan without persisting anything. + if (data && data.ok === false) { throw new Error(currentLang === 'de' - ? 'Dein Plan konnte gerade nicht gespeichert werden. Bitte versuche es erneut.' - : 'Your plan could not be saved just now. Please try again.') + ? 'Dein Plan konnte gerade nicht per E-Mail gesendet werden. Bitte versuche es erneut.' + : 'Your plan could not be emailed just now. Please try again.') + } + if (data && data.report_id && data.report_token) { + answers._report_id = String(data.report_id) + answers._report_token = String(data.report_token) } - answers._report_id = String(data.report_id) - answers._report_token = String(data.report_token) saveState() showSuccess() })