import axios from 'axios' // 开发环境走 vite 代理(留空即可);部署静态站点时用 VITE_API_BASE 指向后端服务 const baseURL = import.meta.env.VITE_API_BASE || '' const http = axios.create({ baseURL }) export const api = { meta: () => http.get('/api/meta').then((r) => r.data), refresh: () => http.post('/api/refresh').then((r) => r.data), fetchHeroes: () => http.get('/api/heroes').then((r) => r.data), saveHeroes: (heroes) => http.post('/api/heroes', { heroes }).then((r) => r.data), applyHeroes: (heroes) => http.post('/api/apply', { heroes }).then((r) => r.data), exportCsv: (heroes) => http.post('/api/export-csv', { heroes }).then((r) => r.data), fetchTemplates: () => http.get('/api/templates').then((r) => r.data), saveTemplates: (templates) => http.post('/api/templates', { templates }).then((r) => r.data), }