@aliyun-obv/api 0.0.48 → 0.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.es.js +18 -1
- package/package.json +3 -3
package/dist/api.es.js
CHANGED
|
@@ -95,6 +95,8 @@ class BaseFetch {
|
|
|
95
95
|
let newInit = init;
|
|
96
96
|
if (hasBaseURL) {
|
|
97
97
|
url = `${this.defaults.baseURL}${url}`;
|
|
98
|
+
}
|
|
99
|
+
if ((url.startsWith("http:") || url.startsWith("https:")) && !url.startsWith(window.location.host)) {
|
|
98
100
|
newInit = __spreadValues$4({}, Object.assign({}, init, { credentials: "include" }));
|
|
99
101
|
}
|
|
100
102
|
if (this.defaults.beforeRequest) {
|
|
@@ -153,7 +155,12 @@ class BaseFetch {
|
|
|
153
155
|
const fetchInit = _.merge({}, defaultInit, {
|
|
154
156
|
body: contentType.includes("application/json") ? JSON.stringify(params) : getPostParam(params)
|
|
155
157
|
});
|
|
156
|
-
const { url: newApi, init: newInit } = yield this.beforeRequest(
|
|
158
|
+
const { url: newApi, init: newInit } = yield this.beforeRequest(
|
|
159
|
+
api,
|
|
160
|
+
params,
|
|
161
|
+
fetchInit,
|
|
162
|
+
options
|
|
163
|
+
);
|
|
157
164
|
const res = yield this.callFetch(newApi, newInit, options);
|
|
158
165
|
if (this.defaults.afterResponse) {
|
|
159
166
|
return yield this.defaults.afterResponse(res, options);
|
|
@@ -756,9 +763,19 @@ slsEasyFetch.defaults.afterResponse = (r, options) => __async$3(void 0, null, fu
|
|
|
756
763
|
return composedData;
|
|
757
764
|
});
|
|
758
765
|
|
|
766
|
+
function getBaseUrl() {
|
|
767
|
+
if (window.ALIYUN_CONSOLE_CONFIG.LOCAL) {
|
|
768
|
+
return `http://pre-observability:${window.location.port}`;
|
|
769
|
+
}
|
|
770
|
+
if (window.ALIYUN_CONSOLE_CONFIG.ENV === "pre") {
|
|
771
|
+
return `https://pre-observability.console.aliyun.com`;
|
|
772
|
+
}
|
|
773
|
+
return `https://observability.console.aliyun.com`;
|
|
774
|
+
}
|
|
759
775
|
const obsEasyFetch = new BaseFetch(finalFetch);
|
|
760
776
|
obsEasyFetch.defaults.postDefaultInit.headers["Content-Type"] = "application/x-www-form-urlencoded";
|
|
761
777
|
obsEasyFetch.defaults.postDefaultInit.headers["Accept"] = "application/json";
|
|
778
|
+
obsEasyFetch.defaults.baseURL = getBaseUrl();
|
|
762
779
|
obsEasyFetch.defaults.errorHandler = errorHandler;
|
|
763
780
|
obsEasyFetch.defaults.beforeRequest = slsEasyFetch.defaults.beforeRequest;
|
|
764
781
|
obsEasyFetch.defaults.afterResponse = slsEasyFetch.defaults.afterResponse;
|
package/package.json
CHANGED
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"urijs": "^1.19.1",
|
|
11
11
|
"lodash": "^4.17.21",
|
|
12
12
|
"@alicloud/console-base-error-prompt-proxy": "^1.9.12",
|
|
13
|
-
"@aliyun-obv/i18n": "0.0.
|
|
14
|
-
"@aliyun-obv/utils": "0.0.
|
|
13
|
+
"@aliyun-obv/i18n": "0.0.49",
|
|
14
|
+
"@aliyun-obv/utils": "0.0.49",
|
|
15
15
|
"@alifd/next": "^1.27.11",
|
|
16
16
|
"styled-components": "^5.2.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {},
|
|
19
|
-
"version": "0.0.
|
|
19
|
+
"version": "0.0.49"
|
|
20
20
|
}
|