1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-21 19:21:18 -04:00

giving yarn v3 a go...

This commit is contained in:
2021-10-19 09:48:03 -04:00
parent 031825fbdc
commit 7fb02275ad
8 changed files with 15925 additions and 10810 deletions

View File

@@ -34,10 +34,10 @@ if (contactForm) {
// we throw identical error messages to the server's so they're caught in
// the same way below.
if (!formData.name || !formData.email || !formData.message) {
throw new Error("MISSING_DATA");
throw new Error("USER_MISSING_DATA");
}
if (!formData["h-captcha-response"]) {
throw new Error("INVALID_CAPTCHA");
throw new Error("USER_INVALID_CAPTCHA");
}
// post JSONified form input to /api/contact/
@@ -71,9 +71,9 @@ if (contactForm) {
const message = error instanceof Error ? error.message : "UNKNOWN_EXCEPTION";
// give user feedback based on the error message returned
if (message === "INVALID_CAPTCHA") {
if (message === "USER_INVALID_CAPTCHA") {
errorSpan.innerText = "Did you complete the CAPTCHA? (If you're human, that is...)";
} else if (message === "MISSING_DATA") {
} else if (message === "USER_MISSING_DATA") {
errorSpan.innerText = "Please make sure that all fields are filled in.";
} else {
// something else went wrong, and it's probably my fault...