拆分前端后台管理 API 客户端
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { apiGet, apiPost } from '@/lib/http'
|
||||
import type { AdminLoginResponse, AdminSessionSummary } from '@/types/admin'
|
||||
|
||||
export function loginAdmin(payload: { username: string; password: string }) {
|
||||
return apiPost<AdminLoginResponse>('/api/v1/admin/auth/login', payload)
|
||||
}
|
||||
|
||||
export function fetchAdminSession() {
|
||||
return apiGet<AdminSessionSummary>('/api/v1/admin/auth/session')
|
||||
}
|
||||
|
||||
export function logoutAdmin() {
|
||||
return apiPost<{ success: boolean }>('/api/v1/admin/auth/logout', {})
|
||||
}
|
||||
Reference in New Issue
Block a user