From b33c7e136ac233c3a4db66aeea0002732408622a Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 8 Feb 2024 20:30:27 +0300 Subject: [PATCH] signal-fix --- src/components/Nav/AuthModal/RegisterForm.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/Nav/AuthModal/RegisterForm.tsx b/src/components/Nav/AuthModal/RegisterForm.tsx index 54e2e69e..a59608c6 100644 --- a/src/components/Nav/AuthModal/RegisterForm.tsx +++ b/src/components/Nav/AuthModal/RegisterForm.tsx @@ -1,5 +1,5 @@ import type { JSX } from 'solid-js' -import { Show, createEffect, createMemo, createSignal } from 'solid-js' +import { Show, createMemo, createSignal } from 'solid-js' import type { AuthModalSearchParams } from './types' import { clsx } from 'clsx' @@ -41,7 +41,6 @@ export const RegisterForm = () => { const [isSubmitting, setIsSubmitting] = createSignal(false) const [isSuccess, setIsSuccess] = createSignal(false) const [validationErrors, setValidationErrors] = createSignal({}) - const [infoEmailMessage, setInfoEmailMessage] = createSignal(false) const [passwordError, setPasswordError] = createSignal() const [emailStatus, setEmailStatus] = createSignal('') @@ -93,7 +92,6 @@ export const RegisterForm = () => { return } setIsSubmitting(true) - setInfoEmailMessage(false) try { const opts = { given_name: cleanName, @@ -115,7 +113,6 @@ export const RegisterForm = () => { const handleCheckEmailStatus = (status: EmailStatus | string) => { switch (status) { case 'not verified': - setInfoEmailMessage(true) setValidationErrors((prev) => ({ ...prev, email: ( @@ -133,7 +130,6 @@ export const RegisterForm = () => { break case 'verified': - setInfoEmailMessage(true) setValidationErrors((prev) => ({ email: ( <> @@ -159,7 +155,7 @@ export const RegisterForm = () => { })) break default: - setInfoEmailMessage(false) + console.info('[RegisterForm] email is not registered') break } } @@ -167,6 +163,7 @@ export const RegisterForm = () => { const handleEmailBlur = async () => { if (validateEmail(email())) { const checkResult = await isRegistered(email()) + setEmailStatus(checkResult) handleCheckEmailStatus(checkResult) } } @@ -190,6 +187,7 @@ export const RegisterForm = () => { handleNameInput(event.currentTarget.value)} @@ -202,7 +200,7 @@ export const RegisterForm = () => {
{ onBlur={handleEmailBlur} /> -
+
{validationErrors().email}