23 lines
895 B
TypeScript
23 lines
895 B
TypeScript
import { createWorkflowService } from '~/services/workflow-service'
|
|
import type { ShipmentData, ShipmentPayload } from '~/services/dto/shipment-data'
|
|
import type { WeightData } from '~/services/dto/weight-data'
|
|
|
|
const service = createWorkflowService<ShipmentData, ShipmentPayload>('shipments', 'shipment')
|
|
|
|
export const getShipmentList = service.getList
|
|
export const getShipment = service.get
|
|
export const createShipment = service.create
|
|
export const updateShipment = service.update
|
|
export const getWeightShipment = service.getWeight as () => Promise<WeightData>
|
|
|
|
export async function deleteShipment(id: number) {
|
|
const { useApi } = await import('~/composables/useApi')
|
|
const api = useApi()
|
|
return api.delete(`shipments/${id}`, {}, {
|
|
toastSuccessKey: 'success.shipment.delete',
|
|
toastErrorKey: 'errors.shipment.delete'
|
|
})
|
|
}
|
|
|
|
export { service as shipmentService }
|