import {useQuery} from 'react-query';
import {fetchUser} from '../api/user';

export function useUser() {
  const data = useQuery('user', fetchUser, {staleTime: 5 * 60 * 1000, retry: false});
  return {...data, isAuthenticated: data.status === 'success'};
}
