From 62cfdba6226e9fb9eb6de7c44f1f5a33c1b1b1d9 Mon Sep 17 00:00:00 2001 From: Seven Date: Mon, 22 Dec 2025 05:03:30 +0700 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=9C=B0=E5=9D=80=E5=92=8CAPI=E7=89=88?= =?UTF-8?q?=E6=9C=AC=EF=BC=9B=E4=BC=98=E5=8C=96=E8=AF=B7=E6=B1=82=E5=A4=B4?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=EF=BC=8C=E5=8A=A8=E6=80=81=E8=8E=B7=E5=8F=96?= =?UTF-8?q?token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.prod | 2 +- package.json | 2 +- pnpm-lock.yaml | 12 ++++++------ src/service/api/client.ts | 9 ++++++--- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.env.prod b/.env.prod index 6f38732..3fb847b 100644 --- a/.env.prod +++ b/.env.prod @@ -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= `{}` diff --git a/package.json b/package.json index 514b50b..6dd7045 100644 --- a/package.json +++ b/package.json @@ -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:*", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e4dd111..52e9daa 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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)) diff --git a/src/service/api/client.ts b/src/service/api/client.ts index 54a020e..fe27ccb 100644 --- a/src/service/api/client.ts +++ b/src/service/api/client.ts @@ -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(baseURL, { - headers: { - Authorization: token || '' + headers() { + const token = localStg.get('token'); + return { + 'Content-Type': 'application/json', + Authorization: token ? `Bearer ${token}` : '' + }; } });