18 lines
433 B
TypeScript
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
|