完善初始化请求链路与异常响应
Security Checks / security (push) Waiting to run

This commit is contained in:
xuans committed 2026-08-30 20:03:37 +08:00
1 parent 19c596a6d4
commit ffa7378480
4 files changed
+54 -4

No files matched your search

+2
View File
@@ -6,6 +6,8 @@ import {router} from "@/router";
const http = axios.create({
baseURL: import.meta.env.VITE_APP_URL, //接口统一域名
timeout: 60000,
// 初始化授权和登录会话都依赖服务端 Cookie;开发代理或反向代理跨源时也必须携带 Cookie。
withCredentials: true,
xsrfCookieName: 'smail_csrf',
xsrfHeaderName: 'X-CSRF-Token',
withXSRFToken: true, //设置超时
+15 -4
View File
@@ -1,12 +1,16 @@
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import { defineConfig, loadEnv } from 'vite'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const backendUrl = (env.VITE_DEV_BACKEND_URL || 'http://127.0.0.1:9001').replace(/\/$/, '')
return {
plugins: [
vue(),
AutoImport({
@@ -24,8 +28,15 @@ export default defineConfig({
server: {
cors: true,
proxy: {
"/api": "http://127.0.0.1/",
"/attachments":"http://127.0.0.1/"
"/api": {
target: backendUrl,
changeOrigin: false
},
"/attachments": {
target: backendUrl,
changeOrigin: false
}
}
}
}
})