import { useApi } from '~/composables/useApi' import type {ShipmentTypeData} from "~/services/dto/shipment-type-data"; export type ShipmentTypeListResponse = | ShipmentTypeData[] | { 'hydra:member'?: ShipmentTypeData[] } export async function getShipmentTypeList(): Promise { const api = useApi() const response = await api.get('shipment_types', {}, { toastErrorKey: 'errors.shipmentType.list' }) if (Array.isArray(response)) { return response } if (response && typeof response === 'object' && Array.isArray(response['hydra:member'])) { return response['hydra:member'] } return [] }