@aliyun-obv/api 0.3.12 → 0.3.14

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.
Files changed (2) hide show
  1. package/dist/api.es.js +7 -5
  2. package/package.json +1 -1
package/dist/api.es.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import _ from 'lodash';
2
- import urijs from 'urijs';
3
2
  import errorPrompt from '@alicloud/console-base-error-prompt-proxy';
4
3
  import i18n, { getMsg } from '@aliyun-obv/i18n';
4
+ import urijs from 'urijs';
5
5
  import { Dialog, Button, Message } from '@alifd/next';
6
6
  import { slsConsoleRuntime, commonUtil, urlUtil, addStubForSearch, addRUMLog, slsConsoleUtil } from '@aliyun-obv/utils';
7
7
  import React from 'react';
@@ -60,6 +60,7 @@ var __async$9 = (__this, __arguments, generator) => {
60
60
  };
61
61
  const isTest = process.env.NODE_ENV === "test";
62
62
  const matchProxyApiReg = /common\/(getApi|postApi|putApi)/;
63
+ const workspaceReg = /\/region\/(.+?)\/workspace\/(.+?)\//;
63
64
  class BaseFetch {
64
65
  constructor(fetchApi) {
65
66
  __publicField(this, "fetchApi");
@@ -89,9 +90,11 @@ class BaseFetch {
89
90
  }
90
91
  beforeRequest(api, params, init, options) {
91
92
  const hasBaseURL = typeof this.defaults.baseURL === "string" && this.defaults.baseURL.trim().length > 0;
92
- const parseQuery = urijs(decodeURIComponent(location.search)).escapeQuerySpace(false).query(true);
93
- if ((params == null ? void 0 : params.product) === "CMS" && (parseQuery == null ? void 0 : parseQuery.cmsRegion) && params.region == null) {
94
- params.region = parseQuery.cmsRegion;
93
+ if ((params == null ? void 0 : params.product) === "CMS" && params.region == null) {
94
+ const re = workspaceReg.exec(window.location.pathname);
95
+ if (re && re[1]) {
96
+ params.region = re[1];
97
+ }
95
98
  }
96
99
  let url = api;
97
100
  let newInit = init;
@@ -1487,4 +1490,3 @@ var dashbordService;
1487
1490
  })(dashbordService || (dashbordService = {}));
1488
1491
 
1489
1492
  export { commonEasyFetch, dashbordService, diamondService, indexService, metaService, obsEasyFetch, projectService, showAlertDialog, showAlertDialogWhenNeedLogin, slsEasyFetch, workSpaceService };
1490
- //# sourceMappingURL=api.es.js.map
package/package.json CHANGED
@@ -15,5 +15,5 @@
15
15
  "styled-components": "^5.2.0"
16
16
  },
17
17
  "devDependencies": {},
18
- "version": "0.3.12"
18
+ "version": "0.3.14"
19
19
  }