/* eslint-disable import/prefer-default-export */
import type { AxiosRequestConfig } from 'axios';
import axios from 'axios';
import getUrls from 'config/urls';
import { love } from './tools';
import type { User } from './types';

const { URL_GET_USER } = getUrls();

export async function getUser(config: AxiosRequestConfig) {
  const user = await axios.get<User>(URL_GET_USER, config).then((res) => love(res.data));

  return user;
}
