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
+8 -3
View File
@@ -41,10 +41,15 @@
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload)
}).then(function (res) {
if (!res.ok) throw new Error("request failed");
form.reset();
submitBtn.disabled = false;
status.textContent = "Thanks — I'll get back to you soon.";
if (res.ok) {
form.reset();
status.textContent = "Thanks — I'll get back to you soon.";
return;
}
return res.text().then(function (msg) {
status.textContent = msg || "Something went wrong sending that. Try again, or email hello@reground.org directly.";
});
}).catch(function () {
submitBtn.disabled = false;
status.textContent = "Something went wrong sending that. Try again, or email hello@reground.org directly.";