Исправление подгрузки данных профиля

This commit is contained in:
Халимов Рустам
2026-04-17 00:43:07 +03:00
parent c264b7df27
commit 7b251686b2

View File

@@ -39,16 +39,22 @@ export class AuthApi {
}
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 {
user: {
...response,
id: response.userId || response.id,
username: response.username || response.userName,
displayName: response.displayName,
avatar: response.avatar || response.avatarUrl
...authRes,
...profileRes,
id: userId,
username: authRes.username || authRes.userName || profileRes.userName,
displayName: authRes.displayName || profileRes.displayName,
avatar: authRes.avatar || authRes.avatarUrl || profileRes.avatarUrl
} as unknown as User,
token: response.accessToken
token: authRes.accessToken
};
}