Files
gestion-certificats2/src/services/api/auth.ts
2025-06-16 14:36:10 +02:00

19 lines
589 B
TypeScript

import { ApiResponse, AuthUser, LoginCredentials } from '../../types'
import { apiClient } from './client'
export const authApi = {
login: async (credentials: LoginCredentials): Promise<ApiResponse<AuthUser>> => {
const response = await apiClient.post('/auth/login', credentials)
return response.data
},
logout: async (): Promise<ApiResponse> => {
const response = await apiClient.post('/auth/logout')
return response.data
},
me: async (): Promise<ApiResponse<AuthUser>> => {
const response = await apiClient.get('/auth/me')
return response.data
},
}