From cf19cdd39bddf6d7236229b2e91deaadb2b536e0 Mon Sep 17 00:00:00 2001 From: Untone Date: Wed, 31 Jan 2024 16:12:59 +0300 Subject: [PATCH] authorizer-upgrade --- src/components/Nav/AuthModal/ForgotPasswordForm.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/Nav/AuthModal/ForgotPasswordForm.tsx b/src/components/Nav/AuthModal/ForgotPasswordForm.tsx index 8dc12583..5fae5e8e 100644 --- a/src/components/Nav/AuthModal/ForgotPasswordForm.tsx +++ b/src/components/Nav/AuthModal/ForgotPasswordForm.tsx @@ -12,6 +12,7 @@ import { validateEmail } from '../../../utils/validateEmail' import { email, setEmail } from './sharedLogic' import styles from './AuthModal.module.scss' +import { ApiResponse, ForgotPasswordResponse } from '@authorizerdev/authorizer-js' type FormFields = { email: string @@ -61,12 +62,15 @@ export const ForgotPasswordForm = () => { setIsSubmitting(true) try { - const response = await authorizer().forgotPassword({ + const response: ApiResponse = await authorizer().forgotPassword({ email: email(), redirect_uri: window.location.origin, }) console.debug('[ForgotPasswordForm] authorizer response:', response) - if (response && response.message) setMessage(response.message) + if (response?.data) setMessage(response.data.message) + else { + console.warn(response.errors) + } } catch (error) { console.error(error) if (error?.code === 'user_not_found') {