21 lines
595 B
TypeScript
21 lines
595 B
TypeScript
import { useApi } from '~/composables/useApi'
|
|
import type { WeightEntryData } from '~/services/dto/reception-data'
|
|
|
|
export type WeightPayload = {
|
|
reception: string
|
|
type: 'gross' | 'tare'
|
|
dsd: number | null
|
|
weight: number | null
|
|
weighedAt: string | null
|
|
}
|
|
|
|
export async function createWeight(payload: WeightPayload) {
|
|
const api = useApi()
|
|
return api.post<WeightEntryData>('weights', payload)
|
|
}
|
|
|
|
export async function updateWeight(id: number, payload: Partial<WeightPayload>) {
|
|
const api = useApi()
|
|
return api.patch<WeightEntryData>(`weights/${id}`, payload)
|
|
}
|