Surface the backend's actual error message instead of a generic fallback
deploy / deploy (push) Successful in 3s

The API already returns specific, honest messages (e.g. 'this course
isn't open for signups yet' for an inactive course) — the frontend was
discarding them and always showing a generic 'something went wrong'.
This commit is contained in:
2026-07-08 18:18:16 -04:00
parent cf87ca5658
commit 857d863c6f
2 changed files with 18 additions and 7 deletions
+10 -4
View File
@@ -32,10 +32,16 @@
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ email: form.email.value })
}).then(function (res) {
if (!res.ok) throw new Error("request failed");
form.reset();
form.hidden = true;
status.textContent = "Check your inbox — day one is on its way.";
if (res.ok) {
form.reset();
form.hidden = true;
status.textContent = "Check your inbox — day one is on its way.";
return;
}
return res.text().then(function (msg) {
submitBtn.disabled = false;
status.textContent = msg || "Something went wrong. Try again in a moment.";
});
}).catch(function () {
submitBtn.disabled = false;
status.textContent = "Something went wrong. Try again in a moment.";