fix(auth): 修复 mixed-content 问题,将认证接口改为相对路径并走代理

This commit is contained in:
肖应宇 2026-06-12 14:30:33 +08:00
parent 95c75ce331
commit da3fad3b44
3 changed files with 69 additions and 69 deletions

View File

@ -38,7 +38,7 @@ describe('Auth Store', () => {
expect(fetchMock).toHaveBeenCalledTimes(1) expect(fetchMock).toHaveBeenCalledTimes(1)
expect(fetchMock).toHaveBeenCalledWith( expect(fetchMock).toHaveBeenCalledWith(
'http://test.xueai.art/newapi/api/login/validateToken', '/api/auth/login/validateToken',
{ {
method: 'POST', method: 'POST',
headers: { headers: {

View File

@ -35,7 +35,7 @@ interface AuthResponse {
} }
// 认证接口 // 认证接口
const AUTH_CHECK_URL = 'http://test.xueai.art/newapi/api/login/validateToken'; const AUTH_CHECK_URL = '/newapi/api/login/validateToken';
const AUTH_TOKEN_STORAGE_KEY = 'DEV_DEFAULT_TOKEN'; const AUTH_TOKEN_STORAGE_KEY = 'DEV_DEFAULT_TOKEN';
export const useAuthStore = defineStore('auth', () => { export const useAuthStore = defineStore('auth', () => {

View File

@ -21,8 +21,8 @@ export default defineConfig({
target: "http://localhost:8002", // Python服务器端口 target: "http://localhost:8002", // Python服务器端口
changeOrigin: true, changeOrigin: true,
}, },
"/api/auth": { "/newapi/api": {
target: "https://sxwz.xueai.art", target: "http://test.xueai.art",
changeOrigin: true, changeOrigin: true,
}, },
}, },