- 新增 MongoDB 存储层实现英雄、预设和版本数据的持久化 - 新增 push-meta 和 migrate-to-mongo 脚本支持数据同步迁移 - 支持开发版和线上设计版双模式运行 - 新增版本闸门机制,线上设计版落后时进入只读模式 - 优化前端 API 配置适配不同部署环境 - 新增线上设计版静态资源托管和路由回退
17 lines
861 B
JavaScript
17 lines
861 B
JavaScript
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),
|
|
}
|