2 Commits
@@ -39,16 +39,22 @@ export class AuthApi {
} }
static async getMe() { static async getMe() {
const response = await httpClient.request<any>('/auth/me'); const authRes = await httpClient.request<any>('/auth/me');
const userId = authRes.userId || authRes.id;
// Пытаемся получить расширенный профиль (био, дата рождения)
const profileRes = await httpClient.request<any>(`/profiles/${userId}`).catch(() => ({}));
return { return {
user: { user: {
...response, ...authRes,
id: response.userId || response.id, ...profileRes,
username: response.username || response.userName, id: userId,
displayName: response.displayName, username: authRes.username || authRes.userName || profileRes.userName,
avatar: response.avatar || response.avatarUrl displayName: authRes.displayName || profileRes.displayName,
avatar: authRes.avatar || authRes.avatarUrl || profileRes.avatarUrl
} as unknown as User, } as unknown as User,
token: response.accessToken token: authRes.accessToken
}; };
} }