diff options
Diffstat (limited to 'website/src/scripts/contact/reset-resend-button.ts')
| -rw-r--r-- | website/src/scripts/contact/reset-resend-button.ts | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/website/src/scripts/contact/reset-resend-button.ts b/website/src/scripts/contact/reset-resend-button.ts deleted file mode 100644 index 21b0adc..0000000 --- a/website/src/scripts/contact/reset-resend-button.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { Selectors } from "./selectors"; - -export function resetResendButton( - { otpDialog }: Selectors, - resendButtonInterval: NodeJS.Timeout | undefined, -): Result { - clearInterval(resendButtonInterval); - - const resendButton = otpDialog.resendButton(); - if (resendButton) { - resendButton.setAttribute("data-countdown", "60"); - resendButton.setAttribute("disabled", ""); - - resendButtonInterval = setInterval(() => { - const countdown = +(resendButton.getAttribute("data-countdown") ?? 1) - 1; - resendButton.setAttribute("data-countdown", countdown.toString()); - resendButton.textContent = `Resend (${countdown}s)`; - }, 1000); - - setTimeout(() => { - clearInterval(resendButtonInterval); - resendButton.textContent = "Resend"; - resendButton.removeAttribute("disabled"); - }, 1000 * 60); - } - - return { resendButtonInterval }; -} - -type Result = { - resendButtonInterval: NodeJS.Timeout | undefined; -}; |
