23 lines
889 B
TypeScript
23 lines
889 B
TypeScript
import { useApi } from '~/composables/useApi'
|
|
import { createWorkflowService } from '~/services/workflow-service'
|
|
import type { ReceptionData, ReceptionPayload } from '~/services/dto/reception-data'
|
|
import type { WeightData } from '~/services/dto/weight-data'
|
|
|
|
const service = createWorkflowService<ReceptionData, ReceptionPayload>('receptions', 'reception')
|
|
|
|
export const getReceptionList = service.getList
|
|
export const getReception = service.get
|
|
export const createReception = service.create
|
|
export const updateReception = service.update
|
|
export const getWeight = service.getWeight as () => Promise<WeightData>
|
|
|
|
export async function deleteReception(id: number) {
|
|
const api = useApi()
|
|
return api.delete(`receptions/${id}`, {}, {
|
|
toastSuccessKey: 'success.reception.delete',
|
|
toastErrorKey: 'errors.reception.delete'
|
|
})
|
|
}
|
|
|
|
export { service as receptionService }
|