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); }