import { useApi } from '~/composables/useApi' import type { WeightEntryData } from '~/services/dto/reception-data' const api = useApi() export type WeightPayload = { reception: string type: 'gross' | 'tare' dsd: number | null weight: number | null weighedAt: string | null } export async function createWeight(payload: WeightPayload) { try { return await api.post('weights', payload) } catch (error) { console.error(error.message, error) throw error } } export async function updateWeight(id: number, payload: Partial) { try { return await api.patch(`weights/${id}`, payload) } catch (error) { console.error(error.message, error) throw error } }