Skip to content

Commit

Permalink
fix: gestion d'erreur dans le dépot simplifié lors de la création d'e…
Browse files Browse the repository at this point in the history
…ntreprise (#793)
  • Loading branch information
remy-auricoste authored Nov 7, 2023
1 parent 545dd46 commit 12eb63b
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { useRouter } from "next/router"
import { useContext, useState } from "react"
import * as Yup from "yup"

import { ApiError } from "@/utils/api.utils"

import { AUTHTYPE } from "../../../common/contants"
import { phoneValidation } from "../../../common/validation/fieldValidations"
import { WidgetContext } from "../../../context/contextWidget"
Expand Down Expand Up @@ -182,10 +184,11 @@ export const InformationCreationCompte = () => {
})
.catch((error) => {
console.error(error)
const { response } = error
const payload: { error: string; statusCode: number; message: string } = response.data
setFieldError("email", payload.message)
setSubmitting(false)
if (error instanceof ApiError) {
const payload: { error: string; statusCode: number; message: string } = error.context.errorData
setFieldError("email", payload.message)
setSubmitting(false)
}
})
}

Expand Down

0 comments on commit 12eb63b

Please sign in to comment.