Files
porridger/front/src/hooks/api/usePoetry.ts
2023-08-08 19:26:38 +03:00

18 lines
433 B
TypeScript

import { composePoetryURL, initialPoetry, processPoetry } from '../../api/poetry'
import { Poetry, isPoetryResponse } from '../../api/poetry/types'
import useFetch, { UseFetchReturn } from '../useFetch'
const usePoetry = (): UseFetchReturn<Poetry> => (
useFetch(
composePoetryURL(),
'GET',
false,
isPoetryResponse,
processPoetry,
initialPoetry,
)
)
export default usePoetry