feat: 更新生产环境配置,修复服务地址和API版本;优化请求头设置,动态获取token

This commit is contained in:
2025-12-22 05:03:30 +07:00
parent 563bc5a990
commit 62cfdba622
4 changed files with 14 additions and 11 deletions

View File

@@ -9,11 +9,14 @@ import { $t } from '@/locales';
const isHttpProxy = import.meta.env.DEV && import.meta.env.VITE_HTTP_PROXY === 'Y';
const { baseURL } = getServiceBaseURL(import.meta.env, isHttpProxy);
const token = localStg.get('token');
const client = treaty<App>(baseURL, {
headers: {
Authorization: token || ''
headers() {
const token = localStg.get('token');
return {
'Content-Type': 'application/json',
Authorization: token ? `Bearer ${token}` : ''
};
}
});