Получение данных профиля

This commit is contained in:
Халимов Рустам
2026-04-17 00:33:45 +03:00
parent ca9cf27716
commit 56f75ae32b

View File

@@ -11,10 +11,11 @@ export class AuthApi {
return {
token: response.accessToken,
user: {
id: response.userId,
username: response.username,
...response,
id: response.userId || (response as any).id,
username: response.username || (response as any).userName,
displayName: response.displayName,
avatar: null
avatar: response.avatar || null
} as User
};
}
@@ -28,22 +29,24 @@ export class AuthApi {
return {
token: response.accessToken,
user: {
id: response.userId,
username: response.username,
...response,
id: response.userId || (response as any).id,
username: response.username || (response as any).userName,
displayName: response.displayName,
avatar: null
avatar: response.avatar || null
} as User
};
}
static async getMe() {
const response = await httpClient.request<{ userId: string; username: string; displayName: string; avatar: string | null; accessToken?: string }>('/auth/me');
const response = await httpClient.request<any>('/auth/me');
return {
user: {
id: response.userId,
username: response.username,
...response,
id: response.userId || response.id,
username: response.username || response.userName,
displayName: response.displayName,
avatar: response.avatar
avatar: response.avatar || response.avatarUrl
} as User,
token: response.accessToken
};