import { REQUEST_TIMEOUT_MS } from "@/app/constant"; import { useAccessStore, useAppConfig } from "@/app/store"; import { getHeaders, UserApi } from "../api"; export class OauthUserApi implements UserApi { async userinfo() { const accessStore = useAccessStore.getState(); const controller = new AbortController(); try { const url = "/api/user"; const payload = { method: "GET", signal: controller.signal, headers: getHeaders(), }; const res = await fetch(url, payload); if (res.status == 401) { accessStore.clearToken(); } console.log("res status", res.status, res.statusText); } catch (e) { console.log("[Request] failed to make a chat request", e); } } }