feat(i18n): first shoot on translated errors

This commit is contained in:
Julien Froidefond
2025-02-27 15:05:44 +01:00
parent 41228e59bc
commit ea51ff53a9
14 changed files with 54 additions and 38 deletions

View File

@@ -5,7 +5,6 @@ import { useRouter } from "next/navigation";
import { authService } from "@/lib/services/auth.service";
import { AuthError } from "@/types/auth";
import { ERROR_CODES } from "@/constants/errorCodes";
import { getErrorMessage } from "@/utils/errors";
import { ErrorMessage } from "@/components/ui/ErrorMessage";
import { useTranslate } from "@/hooks/useTranslate";
@@ -32,7 +31,6 @@ export function RegisterForm({ from }: RegisterFormProps) {
if (password !== confirmPassword) {
setError({
code: ERROR_CODES.AUTH.PASSWORD_MISMATCH,
message: getErrorMessage(ERROR_CODES.AUTH.PASSWORD_MISMATCH),
});
setIsLoading(false);
return;
@@ -99,7 +97,7 @@ export function RegisterForm({ from }: RegisterFormProps) {
className="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
/>
</div>
{error && <ErrorMessage message={error.message} variant="form" />}
{error && <ErrorMessage errorCode={error.code} variant="form" />}
<button
type="submit"
disabled={isLoading}