import { composeUserURL, initialUser, processUser } from '../../api/user'
import { User, isUserResponse } from '../../api/user/types'
import useFetch, { UseFetchReturn } from '../useFetch'

const useUser = (): UseFetchReturn<User> => (
    useFetch(
        composeUserURL(),
        'GET',
        true,
        isUserResponse,
        processUser,
        initialUser
    )
)

export default useUser
