18
front/src/hooks/api/useAnnouncements.ts
Normal file
18
front/src/hooks/api/useAnnouncements.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import useFetch from './useFetch'
|
||||
import { FiltersType } from '../../utils/filters'
|
||||
import { composeAnnouncementsURL, initialAnnouncements, processAnnouncements } from '../../api/announcements'
|
||||
|
||||
import { isAnnouncementsResponse } from '../../api/announcements/types'
|
||||
|
||||
const useAnnouncements = (filters: FiltersType) => {
|
||||
return useFetch(
|
||||
composeAnnouncementsURL(filters),
|
||||
'GET',
|
||||
false,
|
||||
processAnnouncements,
|
||||
isAnnouncementsResponse,
|
||||
initialAnnouncements
|
||||
)
|
||||
}
|
||||
|
||||
export default useAnnouncements
|
Reference in New Issue
Block a user