feat : Ajout de la sélection des bovins étape 3 d'une réception (WIP)

This commit is contained in:
2026-02-03 16:06:52 +01:00
parent 13e8698673
commit 505f67d475
15 changed files with 624 additions and 101 deletions

View File

@@ -0,0 +1,23 @@
import { useApi } from '~/composables/useApi'
import type {BovineTypeData} from "~/services/dto/bovine-type-data";
export type BovineTypeListResponse =
| BovineTypeData[]
| { 'hydra:member'?: BovineTypeData[] }
export async function getBovineTypeList(): Promise<BovineTypeData[]> {
const api = useApi()
const response = await api.get<BovineTypeListResponse>('bovine_types', {}, {
toastErrorKey: 'errors.bovin.list'
})
if (Array.isArray(response)) {
return response
}
if (response && typeof response === 'object' && Array.isArray(response['hydra:member'])) {
return response['hydra:member']
}
return []
}

View File

@@ -0,0 +1,5 @@
export interface BovineTypeData{
id: number
label: string
code: string
}