authorizer-upgrade

This commit is contained in:
Untone 2024-01-31 16:12:59 +03:00
parent 103e73a870
commit cf19cdd39b

View File

@ -12,6 +12,7 @@ import { validateEmail } from '../../../utils/validateEmail'
import { email, setEmail } from './sharedLogic' import { email, setEmail } from './sharedLogic'
import styles from './AuthModal.module.scss' import styles from './AuthModal.module.scss'
import { ApiResponse, ForgotPasswordResponse } from '@authorizerdev/authorizer-js'
type FormFields = { type FormFields = {
email: string email: string
@ -61,12 +62,15 @@ export const ForgotPasswordForm = () => {
setIsSubmitting(true) setIsSubmitting(true)
try { try {
const response = await authorizer().forgotPassword({ const response: ApiResponse<ForgotPasswordResponse> = await authorizer().forgotPassword({
email: email(), email: email(),
redirect_uri: window.location.origin, redirect_uri: window.location.origin,
}) })
console.debug('[ForgotPasswordForm] authorizer response:', response) 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) { } catch (error) {
console.error(error) console.error(error)
if (error?.code === 'user_not_found') { if (error?.code === 'user_not_found') {