Получение данных профиля
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user