feat: enhance user authentication and profile retrieval

- Updated GET handler in auth route to fetch user UUID from cookie using AuthService.
- Improved error handling for unauthenticated and non-existent users.
- Added team name retrieval for the user profile, with fallback handling.
- Refactored AuthClient to return detailed user information including team details.
- Enhanced navigation component to use a dropdown menu for user actions, improving UI/UX.
- Implemented loading state in UserContext to manage user info fetching.
This commit is contained in:
Julien Froidefond
2025-08-25 16:33:10 +02:00
parent 49804c0fa1
commit 42217c1c13
8 changed files with 517 additions and 39 deletions

View File

@@ -51,9 +51,23 @@ export class AuthClient extends BaseHttpClient {
/**
* Récupère l'utilisateur actuel depuis le cookie
*/
async getCurrentUser(): Promise<UserProfile | null> {
async getCurrentUser(): Promise<{
firstName: string;
lastName: string;
teamId: string;
teamName: string;
uuid: string;
} | null> {
try {
const response = await this.get<{ user: UserProfile }>("/auth");
const response = await this.get<{
user: {
firstName: string;
lastName: string;
teamId: string;
teamName: string;
uuid: string;
};
}>("/auth");
return response.user;
} catch (error) {
console.error("Failed to get current user:", error);