From ed72d2f5b4a52201c8143036b344a6ea381b9e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E9=98=B3?= Date: Thu, 2 Jan 2025 16:05:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=99=BE=E5=BA=A6=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E5=8F=8D=E5=90=91=E4=BB=A3=E7=90=86=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Dashboard/components/Stats/index.tsx | 2 +- vite.config.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/Dashboard/components/Stats/index.tsx b/src/pages/Dashboard/components/Stats/index.tsx index fabc22a..e524381 100644 --- a/src/pages/Dashboard/components/Stats/index.tsx +++ b/src/pages/Dashboard/components/Stats/index.tsx @@ -31,7 +31,7 @@ export default () => { const siteId = import.meta.env.VITE_BAIDU_TONGJI_SITE_ID; const token = import.meta.env.VITE_BAIDU_TONGJI_ACCESS_TOKEN; - const response = await fetch(`/api/rest/2.0/tongji/report/getData?access_token=${token}&site_id=${siteId}&start_date=${date}&end_date=${date}&metrics=pv_count%2Cip_count%2Cbounce_ratio%2Cavg_visit_time&method=overview%2FgetTimeTrendRpt`); + const response = await fetch(`/baidu/rest/2.0/tongji/report/getData?access_token=${token}&site_id=${siteId}&start_date=${date}&end_date=${date}&metrics=pv_count%2Cip_count%2Cbounce_ratio%2Cavg_visit_time&method=overview%2FgetTimeTrendRpt`); const data = await response.json(); const { result } = data; diff --git a/vite.config.js b/vite.config.js index 4d249b5..c990908 100644 --- a/vite.config.js +++ b/vite.config.js @@ -23,7 +23,7 @@ export default defineConfig({ }, server: { proxy: { - '/api': { + '/baidu': { target: 'https://openapi.baidu.com/', changeOrigin: true, rewrite: (path) => path.replace(/^\/api/, ''),