import axios from 'axios' // API基础配置 const API_BASE_URL = 'http://192.168.1.52:8001' // 创建axios实例 const apiClient = axios.create({ baseURL: API_BASE_URL, timeout: 30000, headers: { 'Content-Type': 'application/json', }, }) // API端点定义 export const apiEndpoints = { // 认证相关 AUTH: { LOGIN: '/api/token/', REFRESH: '/api/token/refresh/', }, // 学生相关 STUDENTS: { LIST: '/api/students/', CREATE: '/api/students/', UPDATE: (studentId) => `/api/students/${studentId}/`, DELETE: (studentId) => `/api/students/${studentId}/`, }, // 学科相关 SUBJECTS: { LIST: '/api/subjects/', CREATE: '/api/subjects/', UPDATE: (subjectId) => `/api/subjects/${subjectId}/`, DELETE: (subjectId) => `/api/subjects/${subjectId}/`, }, // 学期相关 TERMS: { LIST: '/api/terms/', CREATE: '/api/terms/', UPDATE: '/api/terms/{termId}/', DELETE: '/api/terms/{termId}/', }, } export default apiClient