aboutsummaryrefslogtreecommitdiff
path: root/website/src/scripts/contact/resend-otp.ts
diff options
context:
space:
mode:
Diffstat (limited to 'website/src/scripts/contact/resend-otp.ts')
-rw-r--r--website/src/scripts/contact/resend-otp.ts29
1 files changed, 0 insertions, 29 deletions
diff --git a/website/src/scripts/contact/resend-otp.ts b/website/src/scripts/contact/resend-otp.ts
deleted file mode 100644
index 3f3a4f3..0000000
--- a/website/src/scripts/contact/resend-otp.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { actions } from "astro:actions";
-import { resetResendButton } from "./reset-resend-button";
-import { postErrorMessageOnOtpForm } from "./post-error-message";
-import type { Selectors } from "./selectors";
-
-const fallbackErrorMsg =
- "No can do. I'm afraid joeac.net is a bit broken right now - sorry about that.";
-
-export async function resendOtp(
- selectors: Selectors,
- resetButtonInterval: NodeJS.Timeout | undefined,
-): Promise<Result> {
- const result = resetResendButton(selectors, resetButtonInterval);
- const name = selectors.contactForm.nameElem()?.value;
- const email = selectors.contactForm.emailElem().value;
-
- const sendOtpResult = await actions.otp.send({ type: "email", name, email });
- if (sendOtpResult.error) {
- const errorMsg = sendOtpResult.error?.toString() ?? fallbackErrorMsg;
- postErrorMessageOnOtpForm(selectors, errorMsg);
- throw sendOtpResult.error;
- }
-
- return result;
-}
-
-type Result = {
- resendButtonInterval: NodeJS.Timeout | undefined;
-};