Finalisation réception marchandise, ajout de composant UI et ajout de fixtures (!7)
| Numéro du ticket | Titre du ticket | |------------------|-----------------| | | | ## Description de la PR ## Modification du .env ## Check list - [x] Pas de régression - [ ] TU/TI/TF rédigée - [x] TU/TI/TF OK - [x] CHANGELOG modifié Reviewed-on: https://gitea.malio.fr/MALIO-DEV/Ferme/pulls/7 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { useApi } from '~/composables/useApi'
|
||||
import type { ReceptionTypeData } from '~/services/dto/reception-type-data'
|
||||
|
||||
export type ReceptionTypeListResponse =
|
||||
| ReceptionTypeData[]
|
||||
| { 'hydra:member'?: ReceptionTypeData[] }
|
||||
|
||||
export async function getReceptionTypeList(): Promise<ReceptionTypeData[]> {
|
||||
const api = useApi()
|
||||
const response = await api.get<ReceptionTypeListResponse>('reception_types', {}, {
|
||||
toastErrorKey: 'errors.receptionType.list'
|
||||
})
|
||||
|
||||
if (Array.isArray(response)) {
|
||||
return response
|
||||
}
|
||||
|
||||
if (response && typeof response === 'object' && Array.isArray(response['hydra:member'])) {
|
||||
return response['hydra:member']
|
||||
}
|
||||
|
||||
return []
|
||||
}
|
||||
Reference in New Issue
Block a user