|
@@ -15,8 +15,8 @@ let config = {
|
|
|
withCredentials: true
|
|
|
};
|
|
|
|
|
|
-const _axios = axios.create(config);
|
|
|
-const _axiosWithoutResponseInterceptors = axios.create(config);
|
|
|
+const _$httpWith500Msg = axios.create(config);
|
|
|
+const _$http = axios.create(config);
|
|
|
|
|
|
|
|
|
* A. token lifecycle
|
|
@@ -37,7 +37,7 @@ function getRootOrgId() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-_axios.interceptors.request.use(
|
|
|
+_$httpWith500Msg.interceptors.request.use(
|
|
|
function(config) {
|
|
|
|
|
|
if (
|
|
@@ -84,7 +84,8 @@ _axios.interceptors.request.use(
|
|
|
}
|
|
|
);
|
|
|
|
|
|
-_axiosWithoutResponseInterceptors.interceptors.request.use(
|
|
|
+_$http.interceptors.request.use(
|
|
|
+
|
|
|
function(config) {
|
|
|
|
|
|
if (config.url.includes("/login") === false) {
|
|
@@ -124,7 +125,7 @@ _axiosWithoutResponseInterceptors.interceptors.request.use(
|
|
|
);
|
|
|
|
|
|
|
|
|
-_axios.interceptors.response.use(
|
|
|
+_$httpWith500Msg.interceptors.response.use(
|
|
|
response => {
|
|
|
return response;
|
|
|
},
|
|
@@ -199,7 +200,8 @@ _axios.interceptors.response.use(
|
|
|
);
|
|
|
|
|
|
|
|
|
-_axiosWithoutResponseInterceptors.interceptors.response.use(
|
|
|
+_$http.interceptors.response.use(
|
|
|
+
|
|
|
response => {
|
|
|
return response;
|
|
|
},
|
|
@@ -246,19 +248,33 @@ _axiosWithoutResponseInterceptors.interceptors.response.use(
|
|
|
);
|
|
|
|
|
|
Plugin.install = function(Vue) {
|
|
|
- Vue.$http = _axiosWithoutResponseInterceptors;
|
|
|
+ Vue.$http = _$http;
|
|
|
Object.defineProperties(Vue.prototype, {
|
|
|
$http: {
|
|
|
get() {
|
|
|
- return _axiosWithoutResponseInterceptors;
|
|
|
+ return _$http;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
- Vue.$httpWithMsg = _axios;
|
|
|
+
|
|
|
+ Vue.$httpWithMsg = _$httpWith500Msg;
|
|
|
Object.defineProperties(Vue.prototype, {
|
|
|
$httpWithMsg: {
|
|
|
get() {
|
|
|
- return _axios;
|
|
|
+ return _$httpWith500Msg;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ const _a = axios.create(config);
|
|
|
+ Vue.$httpWithoutAuth = _a;
|
|
|
+ Object.defineProperties(Vue.prototype, {
|
|
|
+ $httpWithoutAuth: {
|
|
|
+ get() {
|
|
|
+ return _a;
|
|
|
}
|
|
|
}
|
|
|
});
|