refactor: no XHR for currentUser but backside

This commit is contained in:
Julien Froidefond
2025-08-25 21:47:15 +02:00
parent 5e1e06be47
commit 565fde2808
5 changed files with 45 additions and 120 deletions

View File

@@ -47,31 +47,4 @@ export class AuthClient extends BaseHttpClient {
async logout(): Promise<{ message: string }> {
return await this.post("/auth/logout");
}
/**
* Récupère l'utilisateur actuel depuis le cookie
*/
async getCurrentUser(): Promise<{
firstName: string;
lastName: string;
teamId: string;
teamName: string;
uuid: string;
} | null> {
try {
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);
return null;
}
}
}