Files
approagency-admin-panel/lib/api/auth.ts
T
2026-02-19 23:18:30 +03:30

21 lines
743 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.put('/auth/logout', {}, token);
},
getProfile: async (token: string): Promise<any> => {
return apiClient.get('/auth/profile', token);
},
};