This commit is contained in:
lik
2026-11-06 20:59:45 +08:00
parent bfe451104d
commit 2f397b9fda
6 changed files with 54 additions and 3 deletions
+4 -1
View File
@@ -1,5 +1,8 @@
import { notify } from '~/utils/notify'
// 生产环境走 https://api.huashengtec.com;本地为空,仍由 vite proxy 转发
const API_BASE = (import.meta.env.VITE_API_BASE || '').replace(/\/+$/, '')
let authToken = ''
let unauthorizedHandler: (() => void) | null = null
@@ -47,7 +50,7 @@ export async function request<T>(path: string, options: RequestOptions = {}): Pr
let response: Response
try {
response = await fetch(`${path}${buildQuery(query)}`, {
response = await fetch(`${API_BASE}${path}${buildQuery(query)}`, {
method,
headers,
body: body === undefined ? undefined : JSON.stringify(body),