import { LatLng } from 'leaflet'

import useFetch from './useFetch'
import { composeTrashboxURL } from '../../api/trashbox'
import { isTrashboxResponse } from '../../api/trashbox/types'

const useTrashboxes = (position: LatLng) =>
    useFetch(
        composeTrashboxURL(position),
        'GET',
        true,
        isTrashboxResponse,
        (data) => data,
        []
    )


export default useTrashboxes
