import { extractItems } from '~/utils/api'

export type InterimAgency = {
    id: number
    name: string
}

export const listInterimAgencies = async (): Promise<InterimAgency[]> => {
    const api = useApi()
    const data = await api.get<InterimAgency[] | { 'hydra:member'?: InterimAgency[] }>(
        '/interim_agencies',
        {},
        { toast: false }
    )
    return extractItems<InterimAgency>(data)
}
