Spaces:
Running

Bot / frontend /src /features /auth /services /authService.ts
ddosvn's picture
Initial deploy of Panel ThTuanIT full stack and Lighthouse-optimized frontend
7e79d39 verified
Raw History Blame Contribute Delete
752 Bytes
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),
};