From 27711d7e99d2367d5f6447d85a54d16289905d21 Mon Sep 17 00:00:00 2001 From: Untone Date: Wed, 31 Jan 2024 16:54:43 +0300 Subject: [PATCH] forgot-form-fox --- .../Nav/AuthModal/ForgotPasswordForm.tsx | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/components/Nav/AuthModal/ForgotPasswordForm.tsx b/src/components/Nav/AuthModal/ForgotPasswordForm.tsx index 1bf2b12d..4e147d92 100644 --- a/src/components/Nav/AuthModal/ForgotPasswordForm.tsx +++ b/src/components/Nav/AuthModal/ForgotPasswordForm.tsx @@ -65,21 +65,16 @@ export const ForgotPasswordForm = () => { email: email(), redirect_uri: window.location.origin, }) - if (data) { - console.debug('[ForgotPasswordForm] authorizer response:', data) - setMessage(data.message) - } - if (errors) { - console.warn(errors) - if (errors) { - const error: Error = errors[0] - if (error.cause === 'user_not_found') { - setIsUserNotFound(true) - return - } else { - setSubmitError(error.message) - } - } + console.debug('[ForgotPasswordForm] authorizer response:', data) + setMessage(data.message) + + console.warn(errors) + if (errors.some((e) => e.cause === 'user_not_found')) { + setIsUserNotFound(true) + return + } else { + const errorText = errors.map((e) => e.message).join(' ') // FIXME + setSubmitError(errorText) } } catch (error) { console.error(error)