From 609426fd7d25c7db283be04d6e6729670c6b837c Mon Sep 17 00:00:00 2001 From: xiamuceer Date: Tue, 6 Jan 2026 19:39:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2=E8=8E=B7=E5=8F=96=E8=81=8C?= =?UTF-8?q?=E4=B8=9A=E4=BF=A1=E6=81=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/Characters.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/frontend/src/pages/Characters.tsx b/frontend/src/pages/Characters.tsx index 1993fcc..46eb776 100644 --- a/frontend/src/pages/Characters.tsx +++ b/frontend/src/pages/Characters.tsx @@ -9,11 +9,10 @@ import { SSELoadingOverlay } from '../components/SSELoadingOverlay'; import type { Character } from '../types'; import { characterApi } from '../services/api'; import { SSEPostClient } from '../utils/sseClient'; -import axios from 'axios'; +import api from '../services/api'; const { Title } = Typography; const { TextArea } = Input; -const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'http://localhost:8000'; interface Career { id: string; @@ -59,12 +58,11 @@ export default function Characters() { const fetchCareers = async () => { if (!currentProject?.id) return; try { - const response = await axios.get(`${API_BASE_URL}/api/careers`, { - params: { project_id: currentProject.id }, - headers: { Authorization: `Bearer ${localStorage.getItem('token')}` } + const response = await api.get('/careers', { + params: { project_id: currentProject.id } }); - setMainCareers(response.data.main_careers || []); - setSubCareers(response.data.sub_careers || []); + setMainCareers(response.main_careers || []); + setSubCareers(response.sub_careers || []); } catch (error) { console.error('获取职业列表失败:', error); }