import { AxiosError } from "axios"; import { GET_CURRENT_USER_STATS } from "../constants/api"; import { IHttpResponse } from "../types/common"; import { client } from "./config"; async function getUserStatsService(): Promise { const newState: IHttpResponse = { data: null, error: null }; try { const res = await client({ method: 'GET', url: GET_CURRENT_USER_STATS, withCredentials: true}) newState.data = res.data newState.status = res.status return newState } catch(error) { let err = error as AxiosError newState.error = err newState.status = err.status throw(newState) } } export { getUserStatsService, }