Spaces:
Running
Running
File size: 752 Bytes
7e79d39 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import { requestJson } from '@/shared/lib/httpClient';
import { AuthUser, PublicPanelConfig } from '../types/authTypes';
export const authService = {
login: (username: string, password: string) =>
requestJson<{ token: string; user: AuthUser }>(
'/auth/login',
{ method: 'POST', body: JSON.stringify({ username, password }) },
false,
),
register: (username: string, email: string, password: string) =>
requestJson<{ token: string; user: AuthUser }>(
'/auth/register',
{ method: 'POST', body: JSON.stringify({ username, email, password }) },
false,
),
getMe: () => requestJson<{ user: AuthUser }>('/auth/me'),
getPublicConfig: () => requestJson<PublicPanelConfig>('/config', {}, false),
};
|