| Numéro du ticket | Titre du ticket | |------------------|-----------------| | #203 | Réceptions — Parcours de pesée multi-étapes | ## Description de la PR [#203] Réceptions — Parcours de pesée multi-étapes ## Modification du .env ## Check list - [x] Pas de régression - [x] TU/TI/TF rédigée - [x] TU/TI/TF OK - [x] CHANGELOG modifié Reviewed-on: #3 Reviewed-by: THOLOT DECHENE Matthieu <matthieu@yuno.malio.fr> Co-authored-by: AUTIN Tristan <tristan@yuno.malio.fr> Co-committed-by: AUTIN Tristan <tristan@yuno.malio.fr>
31 lines
791 B
TypeScript
31 lines
791 B
TypeScript
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<WeightEntryData>('weights', payload)
|
|
} catch (error) {
|
|
console.error(error.message, error)
|
|
throw error
|
|
}
|
|
}
|
|
|
|
export async function updateWeight(id: number, payload: Partial<WeightPayload>) {
|
|
try {
|
|
return await api.patch<WeightEntryData>(`weights/${id}`, payload)
|
|
} catch (error) {
|
|
console.error(error.message, error)
|
|
throw error
|
|
}
|
|
}
|