feat : Ajout de zod, création d'un composant de chargement loading-dots.vue et finalisation du flow d'une reception

This commit is contained in:
2026-01-13 15:52:47 +01:00
parent cfe7baa4ae
commit 6dab1d789a
19 changed files with 547 additions and 165 deletions

View File

@@ -0,0 +1,30 @@
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
}
}