update vuecli proxy

This commit is contained in:
2022-09-19 16:30:50 +08:00
parent 10e454eb2a
commit e532989ddf
12 changed files with 47 additions and 17 deletions

View File

@@ -7,7 +7,9 @@ import isPlainObject from 'lodash/isPlainObject'
import merge from 'lodash/merge'
const http = axios.create({
baseURL: window.SITE_CONFIG['apiURL'],
// baseURL: window.SITE_CONFIG['apiURL'],
// baseURL: '/api',
baseURL: process.env.NODE_ENV === 'production' ? '/api' : '/yd-monitor',
timeout: 1000 * 180,
withCredentials: true
})
@@ -71,7 +73,9 @@ http.interceptors.response.use(response => {
*/
http.adornUrl = (actionName) => {
// 非生产环境 && 开启代理, 接口前缀统一使用[/proxyApi/]前缀做代理拦截!
return (process.env.NODE_ENV !== 'production' && process.env.OPEN_PROXY ? '/proxyApi/' : window.SITE_CONFIG.projURL) + actionName
// return (process.env.NODE_ENV !== 'production' && process.env.OPEN_PROXY ? window.SITE_CONFIG.projURL : '') + actionName
// return (process.env.NODE_ENV !== 'production' ? '/yd-monitor' : '/api') + actionName
return actionName
}
/**