refactor: update authentication flow and cookie management

- Changed COOKIE_NAME from "peakSkills_userId" to "session_token" for better clarity.
- Updated AuthClient to handle login and registration with new data structures.
- Enhanced AuthWrapper to manage user sessions and display appropriate messages.
- Added error handling in LoginForm and RegisterForm for better user feedback.
- Refactored user service methods to streamline user creation and verification processes.
This commit is contained in:
Julien Froidefond
2025-08-25 16:19:31 +02:00
parent caf396d964
commit 5c71ce1a54
14 changed files with 537 additions and 91 deletions

View File

@@ -25,6 +25,7 @@ interface RegisterFormProps {
}) => void;
onSwitchToLogin: () => void;
loading?: boolean;
error?: string | null;
}
export function RegisterForm({
@@ -32,6 +33,7 @@ export function RegisterForm({
onSubmit,
onSwitchToLogin,
loading = false,
error = null,
}: RegisterFormProps) {
const [firstName, setFirstName] = useState("");
const [lastName, setLastName] = useState("");
@@ -138,6 +140,12 @@ export function RegisterForm({
</CardDescription>
</CardHeader>
<CardContent>
{error && (
<div className="mb-4 p-3 bg-red-500/20 border border-red-500/50 rounded-md">
<p className="text-red-400 text-sm">{error}</p>
</div>
)}
<form onSubmit={handleSubmit} className="space-y-4">
<div className="grid grid-cols-2 gap-4">
<div className="space-y-2">