Spaces:
Running
Running
File size: 427 Bytes
4f9f661 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import { query } from '@/shared/api/query';
import { AuthResponse, LoginRequest } from './types';
export const login = async (data: LoginRequest): Promise<AuthResponse> => {
const response = await query<AuthResponse>({
url: '/auth/login',
method: 'post',
data,
});
if ('error' in response) {
throw new Error(`Ошибка авторизации: ${response.error.status}`);
}
return response.data;
}; |