feat: 更新生产环境配置,修复服务地址和API版本;优化请求头设置,动态获取token
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# backend service base url, prod environment
|
||||
VITE_SERVICE_BASE_URL=http://192.168.1.27:9528
|
||||
VITE_SERVICE_BASE_URL=http://192.168.1.27:9527
|
||||
|
||||
# other backend service base url, prod environment
|
||||
VITE_OTHER_SERVICE_BASE_URL= `{}`
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
"@better-scroll/core": "2.5.1",
|
||||
"@elysiajs/eden": "^1.4.5",
|
||||
"@iconify/vue": "5.0.0",
|
||||
"@riwa/api-types": "http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz",
|
||||
"@riwa/api-types": "http://192.168.1.27:9527/api/riwa-api-types-0.0.47.tgz",
|
||||
"@sa/axios": "workspace:*",
|
||||
"@sa/color": "workspace:*",
|
||||
"@sa/hooks": "workspace:*",
|
||||
|
||||
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
@@ -18,8 +18,8 @@ importers:
|
||||
specifier: 5.0.0
|
||||
version: 5.0.0(vue@3.5.25(typescript@5.9.3))
|
||||
'@riwa/api-types':
|
||||
specifier: http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz
|
||||
version: http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))
|
||||
specifier: http://192.168.1.27:9527/api/riwa-api-types-0.0.47.tgz
|
||||
version: http://192.168.1.27:9527/api/riwa-api-types-0.0.47.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))
|
||||
'@sa/axios':
|
||||
specifier: workspace:*
|
||||
version: link:packages/axios
|
||||
@@ -1068,9 +1068,9 @@ packages:
|
||||
'@quansync/fs@0.1.6':
|
||||
resolution: {integrity: sha512-zoA8SqQO11qH9H8FCBR7NIbowYARIPmBz3nKjgAaOUDi/xPAAu1uAgebtV7KXHTc6CDZJVRZ1u4wIGvY5CWYaw==}
|
||||
|
||||
'@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz':
|
||||
resolution: {tarball: http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz}
|
||||
version: 0.0.44
|
||||
'@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.47.tgz':
|
||||
resolution: {tarball: http://192.168.1.27:9527/api/riwa-api-types-0.0.47.tgz}
|
||||
version: 0.0.47
|
||||
peerDependencies:
|
||||
'@elysiajs/eden': ^1.4.5
|
||||
|
||||
@@ -5057,7 +5057,7 @@ snapshots:
|
||||
dependencies:
|
||||
quansync: 0.3.0
|
||||
|
||||
'@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))':
|
||||
'@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.47.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))':
|
||||
dependencies:
|
||||
'@elysiajs/eden': 1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3))
|
||||
|
||||
|
||||
@@ -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}` : ''
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user