feat: upgrade global API prefix from /api to /api/v1

main
sp mac bookpro 2605 2026-07-27 19:41:32 +08:00
parent 39349bfb8c
commit 1482ef9cf3
2 changed files with 2 additions and 3 deletions

View File

@ -1,7 +1,7 @@
import axios from 'axios';
import { clearUserStorage } from '../utils/storage';
export const API_BASE_URL = import.meta.env.DEV ? '/api/' : 'https://www.tianchaoai.cc/api/v1/';
export const API_BASE_URL = import.meta.env.DEV ? '/api/v1/' : 'https://www.tianchaoai.cc/api/v1/';
const APP_BASE = (import.meta.env.BASE_URL || '/').replace(/\/$/, '');
export const withAppBase = (path: string) => `${APP_BASE}${path.startsWith('/') ? path : `/${path}`}`;
export const withApiBase = (path: string) => `${API_BASE_URL}${path.replace(/^\//, '')}`;

View File

@ -13,10 +13,9 @@ export default defineConfig(({ command, mode }) => {
server: {
port: 3001,
proxy: {
'/api': {
'/api/v1': {
target,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '/api/v1'),
// SSE 不要被压缩;保持长连接
configure: (proxy) => {
proxy.on('proxyReq', (proxyReq) => {