37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import api from './api'
|
|
|
|
export const getAntrianOperasi = async (params: { type?: string; limit?: number; offset?: number; status?: string | undefined; search?: string | undefined; type_id?: string | undefined } = {}) => {
|
|
const { type = 'all', limit = 10, offset = 0, status = undefined, search = undefined, type_id = undefined } = params
|
|
const response = await api.get('/antrian-operasi', {
|
|
params: { type, limit, offset, status, search, type_id }
|
|
})
|
|
return response.data
|
|
}
|
|
|
|
export const getAntrianOperasiById = async (id: string | number) => {
|
|
const response = await api.get(`/antrian-operasi/${id}`)
|
|
return response.data
|
|
}
|
|
|
|
export const updateStatusAntrianOperasi = async (id: string | number, data: any) => {
|
|
const response = await api.put(`/antrian-operasi/${id}/update-status`, data)
|
|
return response.data
|
|
}
|
|
|
|
export const deleteAntrianOperasi = async (id: string | number) => {
|
|
const response = await api.delete(`/antrian-operasi/${id}`)
|
|
return response.data
|
|
}
|
|
|
|
export const getAntrianPerSpesialis = async () => {
|
|
const response = await api.get('/dashboard/antrian-per-spesialis')
|
|
const sortedData = response.data.data.sort((a: any, b: any) =>
|
|
a.Spesialis.localeCompare(b.Spesialis)
|
|
)
|
|
|
|
return {
|
|
...response.data,
|
|
data: sortedData
|
|
}
|
|
}
|