pre-deep-ddd-refactor

This commit is contained in:
Халимов Рустам
2026-03-19 22:07:23 +03:00
parent abd94d6154
commit fb252f9d87
34 changed files with 1152 additions and 975 deletions
@@ -0,0 +1,30 @@
import { httpClient } from '../../../lib/httpClient';
import type { User } from '../../../lib/types';
export class AuthApi {
static async login(username: string, password: string) {
return httpClient.request<{ token: string; user: User }>('/auth/login', {
method: 'POST',
body: JSON.stringify({ username, password }),
});
}
static async register(username: string, displayName: string, password: string, bio?: string) {
return httpClient.request<{ token: string; user: User }>('/auth/register', {
method: 'POST',
body: JSON.stringify({ username, displayName, password, bio }),
});
}
static async getMe() {
return httpClient.request<{ user: User }>('/auth/me');
}
static async getConfig() {
return httpClient.request<any>('/config');
}
static setToken(token: string | null) {
httpClient.setToken(token);
}
}