🛂 Migrate to Chakra UI v3 (#1496)

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Alejandra
2025-02-17 19:33:00 +00:00
committed by GitHub
parent 74e2604faf
commit 55df823739
60 changed files with 4682 additions and 4399 deletions

View File

@@ -1,4 +1,5 @@
import type { ApiError } from "./client"
import useCustomToast from "./hooks/useCustomToast"
export const emailPattern = {
value: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,
@@ -43,11 +44,12 @@ export const confirmPasswordRules = (
return rules
}
export const handleError = (err: ApiError, showToast: any) => {
export const handleError = (err: ApiError) => {
const { showErrorToast } = useCustomToast()
const errDetail = (err.body as any)?.detail
let errorMessage = errDetail || "Something went wrong."
if (Array.isArray(errDetail) && errDetail.length > 0) {
errorMessage = errDetail[0].msg
}
showToast("Error", errorMessage, "error")
showErrorToast(errorMessage)
}