http: adds scripts

This commit is contained in:
2026-06-04 15:15:02 +01:00
parent fac1199cd6
commit 813836fbba
7 changed files with 320 additions and 0 deletions
@@ -0,0 +1,34 @@
/** @typedef {import("./selectors.js").Selectors} Selectors */
/**
* @param {{contactForm: Selectors}} contactForm
* @param {string} errorMsg
*/
export function postErrorMessageOnContactForm({ contactForm }, errorMsg) {
const errorElem = contactForm.errorElem();
if (errorElem) {
errorElem.textContent = errorMsg;
errorElem.removeAttribute("hidden");
} else {
alert(errorMsg);
}
}
/**
* @param {{otpDialog: Selectors}} otpDialog
* @param {string} errorMsg
*/
export function postErrorMessageOnOtpForm({ otpDialog }, errorMsg) {
const errorElem = otpDialog.errorElem();
if (errorElem) {
errorElem.textContent = errorMsg;
errorElem.removeAttribute("hidden");
} else {
alert(errorMsg);
}
/** @type NodeListOf<HTMLInputElement> */
const inputs = otpDialog.allOtpInputs();
for (const input of inputs) {
input.value = "";
}
}