File size: 533 Bytes
4bcd925
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import apiClient from './client'
import type { LoginRequest, LoginResponse } from '@/types/api'

export const authApi = {
  login: (data: LoginRequest) => {
    const payload = new URLSearchParams()
    payload.append('admin_key', data.password)
    return apiClient.post<URLSearchParams, LoginResponse>('/login', payload, {
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
      },
    })
  },

  logout: () =>
    apiClient.post('/logout'),

  checkAuth: () =>
    apiClient.get('/admin/health'),
}