start
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import type { Employee } from '~/types/api'
|
||||
import { request } from '~/utils/request'
|
||||
|
||||
export type EmployeeListQuery = {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
role?: string
|
||||
status?: string
|
||||
keyword?: string
|
||||
}
|
||||
|
||||
export const employeeApi = {
|
||||
list: (query: EmployeeListQuery) =>
|
||||
request<{ employees: Employee[]; total: number; page: number; pageSize: number }>(
|
||||
'/health/employee',
|
||||
{ query }
|
||||
),
|
||||
|
||||
create: (body: Record<string, unknown>) =>
|
||||
request<{ employee: Employee }>('/health/employee', {
|
||||
method: 'POST',
|
||||
body,
|
||||
}),
|
||||
|
||||
update: (id: string, body: Record<string, unknown>) =>
|
||||
request<{ employee: Employee }>(`/health/employee/${id}`, {
|
||||
method: 'PUT',
|
||||
body,
|
||||
}),
|
||||
|
||||
updateStatus: (id: string, status: string) =>
|
||||
request<{ employee: Employee }>(`/health/employee/${id}/status`, {
|
||||
method: 'PATCH',
|
||||
body: { status },
|
||||
}),
|
||||
}
|
||||
Reference in New Issue
Block a user