refacto: errors in apis

This commit is contained in:
Julien Froidefond
2025-02-25 08:40:06 +01:00
parent bf6fa0a71d
commit a690a5af6f
29 changed files with 720 additions and 109 deletions

View File

@@ -4,6 +4,8 @@ import { useState } from "react";
import { useRouter } from "next/navigation";
import { authService } from "@/lib/services/auth.service";
import { AuthError } from "@/types/auth";
import { ERROR_CODES } from "@/constants/errorCodes";
import { ERROR_MESSAGES } from "@/constants/errorMessages";
interface RegisterFormProps {
from?: string;
@@ -26,8 +28,8 @@ export function RegisterForm({ from }: RegisterFormProps) {
if (password !== confirmPassword) {
setError({
code: "SERVER_ERROR",
message: "Les mots de passe ne correspondent pas",
code: ERROR_CODES.AUTH.PASSWORD_MISMATCH,
message: ERROR_MESSAGES[ERROR_CODES.AUTH.PASSWORD_MISMATCH],
});
setIsLoading(false);
return;