porridger/front/src/hooks/api/useAnnouncements.ts
2023-07-16 00:08:51 +03:00

19 lines
537 B
TypeScript

import { useFetch } from '../'
import { FiltersType } from '../../utils/filters'
import { composeAnnouncementsURL, initialAnnouncements, processAnnouncements } from '../../api/announcements'
import { isAnnouncementsResponse } from '../../api/announcements/types'
const useAnnouncements = (filters: FiltersType) => (
useFetch(
composeAnnouncementsURL(filters),
'GET',
false,
isAnnouncementsResponse,
processAnnouncements,
initialAnnouncements
)
)
export default useAnnouncements