refacto: UI and component for error in loginpage

This commit is contained in:
Julien Froidefond
2025-02-25 08:46:29 +01:00
parent a690a5af6f
commit 15a27005a0
3 changed files with 20 additions and 11 deletions

View File

@@ -6,6 +6,7 @@ import { authService } from "@/lib/services/auth.service";
import { AuthError } from "@/types/auth";
import { ERROR_CODES } from "@/constants/errorCodes";
import { ERROR_MESSAGES } from "@/constants/errorMessages";
import { ErrorMessage } from "@/components/ui/ErrorMessage";
interface RegisterFormProps {
from?: string;
@@ -96,11 +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 && (
<div className="rounded-md bg-destructive/15 p-3 text-sm text-destructive">
{error.message}
</div>
)}
{error && <ErrorMessage message={error.message} variant="form" />}
<button
type="submit"
disabled={isLoading}