import { love } from './tools'; import type { User } from './types'; import getUrls from '@/config/urls'; import type { AxiosError, AxiosRequestConfig } from 'axios'; import axios from 'axios'; const { URL_GET_USER } = getUrls(); export async function getUser(config?: AxiosRequestConfig) { return axios .get(URL_GET_USER, config) .then((res) => love(res.data)) .catch((error: AxiosError | Error) => { if (axios.isAxiosError(error)) { // TODO: track error throw new Error(error.message); } }); }