21 lines
744 B
TypeScript
21 lines
744 B
TypeScript
import { apiClient } from './client';
|
|
import { LoginCredentials, LoginResponse } from '@/types/auth';
|
|
|
|
export const authApi = {
|
|
login: async (credentials: LoginCredentials): Promise<LoginResponse> => {
|
|
const formData = new FormData();
|
|
formData.append('auth', credentials.auth);
|
|
formData.append('password', credentials.password);
|
|
formData.append('package_name', credentials.package_name);
|
|
|
|
return apiClient.post<LoginResponse>('/auth/login', formData);
|
|
},
|
|
|
|
logout: async (token: string): Promise<void> => {
|
|
return apiClient.post('/auth/logout', {}, token);
|
|
},
|
|
|
|
getProfile: async (token: string): Promise<any> => {
|
|
return apiClient.get('/auth/profile', token);
|
|
},
|
|
}; |