feat: upgrade global API prefix from /api to /api/v1
parent
39349bfb8c
commit
1482ef9cf3
|
|
@ -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(/^\//, '')}`;
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue