From 26147fa990fddf2a0c45dadd73b096d34294b640 Mon Sep 17 00:00:00 2001 From: selfrelease Date: Sat, 1 Aug 2026 07:19:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20portal=20=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=20top-level=20await=20=E5=AF=BC=E8=87=B4=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E6=9E=84=E5=BB=BA=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/portal/EmployeeHome.tsx | 3 ++- frontend/src/pages/portal/OnboardingProgress.tsx | 3 ++- frontend/src/pages/portal/ResignationApply.tsx | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/src/pages/portal/EmployeeHome.tsx b/frontend/src/pages/portal/EmployeeHome.tsx index db4ddba..1a5596a 100644 --- a/frontend/src/pages/portal/EmployeeHome.tsx +++ b/frontend/src/pages/portal/EmployeeHome.tsx @@ -11,9 +11,10 @@ import { } from 'lucide-react' import Card from '../../components/ui/Card' import { InlineAlert } from '../../components/ui/InlineAlert' +import axios from 'axios' /** 员工端 API 实例(自动携带 portalToken) */ -const portalApi = (await import('../../lib/api')).default.create({ baseURL: '/api/v1/portal' }) +const portalApi = axios.create({ baseURL: '/api/v1/portal' }) portalApi.interceptors.request.use((config: any) => { const token = localStorage.getItem('portalToken') if (token) config.headers.Authorization = `Bearer ${token}` diff --git a/frontend/src/pages/portal/OnboardingProgress.tsx b/frontend/src/pages/portal/OnboardingProgress.tsx index f3bd2d8..7b95468 100644 --- a/frontend/src/pages/portal/OnboardingProgress.tsx +++ b/frontend/src/pages/portal/OnboardingProgress.tsx @@ -7,9 +7,10 @@ import { Check, Clock, AlertCircle, FileText, Upload, User, Phone, Banknote } fr import Card from '../../components/ui/Card' import { InlineAlert } from '../../components/ui/InlineAlert' import { Stepper } from '../../components/ui/Stepper' +import axios from 'axios' /** 员工端 API 实例 */ -const portalApi = (await import('../../lib/api')).default.create({ baseURL: '/api/v1/portal' }) +const portalApi = axios.create({ baseURL: '/api/v1/portal' }) portalApi.interceptors.request.use((config: any) => { const token = localStorage.getItem('portalToken') if (token) config.headers.Authorization = `Bearer ${token}` diff --git a/frontend/src/pages/portal/ResignationApply.tsx b/frontend/src/pages/portal/ResignationApply.tsx index cac4e45..c664b72 100644 --- a/frontend/src/pages/portal/ResignationApply.tsx +++ b/frontend/src/pages/portal/ResignationApply.tsx @@ -9,9 +9,10 @@ import Card from '../../components/ui/Card' import Button from '../../components/ui/Button' import { Input, Label, Select } from '../../components/ui/Input' import { InlineAlert } from '../../components/ui/InlineAlert' +import axios from 'axios' /** 员工端 API 实例 */ -const portalApi = (await import('../../lib/api')).default.create({ baseURL: '/api/v1/portal' }) +const portalApi = axios.create({ baseURL: '/api/v1/portal' }) portalApi.interceptors.request.use((config: any) => { const token = localStorage.getItem('portalToken') if (token) config.headers.Authorization = `Bearer ${token}`