e# speciallyse enter a commit message to explain why this merge is

necessary,
if it merges an updated upstream into a topic branch.
This commit is contained in:
max
2026-04-17 00:42:48 +03:00
@@ -3,7 +3,7 @@ import type { User } from '../../../core/domain/types';
export class AuthApi { export class AuthApi {
static async login(username: string, password: string) { static async login(username: string, password: string) {
const response = await httpClient.request<{ accessToken: string; userId: string; username: string; displayName: string }>('/auth/login', { const response = await httpClient.request<any>('/auth/login', {
method: 'POST', method: 'POST',
body: JSON.stringify({ username, password }), body: JSON.stringify({ username, password }),
}); });
@@ -11,16 +11,17 @@ export class AuthApi {
return { return {
token: response.accessToken, token: response.accessToken,
user: { user: {
id: response.userId, ...response,
username: response.username, id: response.userId || (response as any).id,
username: response.username || (response as any).userName,
displayName: response.displayName, displayName: response.displayName,
avatar: null avatar: response.avatar || null
} as User } as unknown as User
}; };
} }
static async register(username: string, displayName: string, password: string, bio?: string) { static async register(username: string, displayName: string, password: string, bio?: string) {
const response = await httpClient.request<{ accessToken: string; userId: string; username: string; displayName: string }>('/auth/register', { const response = await httpClient.request<any>('/auth/register', {
method: 'POST', method: 'POST',
body: JSON.stringify({ username, displayName, password, bio }), body: JSON.stringify({ username, displayName, password, bio }),
}); });
@@ -28,23 +29,25 @@ export class AuthApi {
return { return {
token: response.accessToken, token: response.accessToken,
user: { user: {
id: response.userId, ...response,
username: response.username, id: response.userId || (response as any).id,
username: response.username || (response as any).userName,
displayName: response.displayName, displayName: response.displayName,
avatar: null avatar: response.avatar || null
} as User } as unknown as User
}; };
} }
static async getMe() { 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 { return {
user: { user: {
id: response.userId, ...response,
username: response.username, id: response.userId || response.id,
username: response.username || response.userName,
displayName: response.displayName, displayName: response.displayName,
avatar: response.avatar avatar: response.avatar || response.avatarUrl
} as User, } as unknown as User,
token: response.accessToken token: response.accessToken
}; };
} }