Commit 85f9cd4f authored by 成旭东's avatar 成旭东

fix

parent dfc1f35d
Pipeline #27829 failed with stage
in 45 seconds
......@@ -32,11 +32,6 @@
"test:component": "umi test ./src/components",
"tsc": "tsc"
},
"husky": {
"hooks": {
"pre-commit": "npm run lint-staged"
}
},
"lint-staged": {
"**/*.less": "stylelint --syntax less",
"**/*.{js,jsx,ts,tsx}": "npm run lint-staged:js",
......
let DEFAULT_API_HOST = 'https://uat-nginx.jianbing.com/cms_api';
const { host } = window.location;
let DEFAULT_API_HOST = `https://${host}/api`;
if (/^127\.0\.0\.1/.test(host) || /^localhost/.test(host) || /^192\.168\./.test(host)) {
DEFAULT_API_HOST = `http://${host}/cms_api`;
}
......
......@@ -59,10 +59,12 @@ const errorHandler = (error: { response: Response, data: object }): Response | o
/**
* 配置request请求时的默认参数
*/
const { host } = window.location;
const request = extend({
errorHandler, // 默认错误处理
credentials: 'include', // 默认请求是否带上cookie
prefix: '/cms_api',
prefix: host.indexOf('com') > -1 ? '/api' : '/cms_api',
});
// request拦截器, 改变url 或 options.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment