feat : ajout de la génération du bon de reception, correction de la base du formulaire multi-etape de reception et ajout d'une gestion d'erreur global
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
import { useApi } from '~/composables/useApi'
|
||||
import type { WeightEntryData } from '~/services/dto/reception-data'
|
||||
|
||||
const api = useApi()
|
||||
|
||||
export type WeightPayload = {
|
||||
reception: string
|
||||
type: 'gross' | 'tare'
|
||||
@@ -12,19 +10,11 @@ export type WeightPayload = {
|
||||
}
|
||||
|
||||
export async function createWeight(payload: WeightPayload) {
|
||||
try {
|
||||
return await api.post<WeightEntryData>('weights', payload)
|
||||
} catch (error) {
|
||||
console.error(error.message, error)
|
||||
throw error
|
||||
}
|
||||
const api = useApi()
|
||||
return api.post<WeightEntryData>('weights', payload)
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
const api = useApi()
|
||||
return api.patch<WeightEntryData>(`weights/${id}`, payload)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user