@gct-paas/core 0.0.1-dev.21 → 0.0.1-dev.22

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.
@@ -1,3 +1,4 @@
1
1
  export declare const CoreConst: {
2
2
  TOKEN: string;
3
+ TENANT: string;
3
4
  };
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  const CoreConst = {
3
- TOKEN: "gct-token"
3
+ TOKEN: "gct-token",
4
+ TENANT: "gct-tenant"
4
5
  };
5
6
 
6
7
  export { CoreConst };
@@ -23,6 +23,20 @@ export declare function getToken(): string | null;
23
23
  * @param {string} token
24
24
  */
25
25
  export declare function setToken(token: string): void;
26
+ /**
27
+ * 从 cookie 获取租户标识
28
+ *
29
+ * @export
30
+ * @returns {*} {(string | null)}
31
+ */
32
+ export declare function getTenant(): string | null;
33
+ /**
34
+ * 设置租户标识至 cookie
35
+ *
36
+ * @export
37
+ * @param {string} tenant
38
+ */
39
+ export declare function setTenant(tenant: string): void;
26
40
  /**
27
41
  * 获取路径参数
28
42
  *
@@ -31,6 +31,16 @@ function setToken(token) {
31
31
  clearCookie(CoreConst.TOKEN);
32
32
  }
33
33
  }
34
+ function getTenant() {
35
+ return getCookie(CoreConst.TENANT);
36
+ }
37
+ function setTenant(tenant) {
38
+ if (tenant) {
39
+ setCookie(CoreConst.TENANT, tenant, 0, true);
40
+ } else {
41
+ clearCookie(CoreConst.TENANT);
42
+ }
43
+ }
34
44
  function getPathQuery() {
35
45
  const params = location.pathname.replace("/src/projects", "").split("/");
36
46
  return {
@@ -49,4 +59,4 @@ function getTimezone() {
49
59
  return localStorage.getItem(TIMEZONE_KEY) || "UTC+08:00";
50
60
  }
51
61
 
52
- export { deepMerge, getPathQuery, getTimezone, getToken, isMobile, setToken };
62
+ export { deepMerge, getPathQuery, getTenant, getTimezone, getToken, isMobile, setTenant, setToken };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/core",
3
- "version": "0.0.1-dev.21",
3
+ "version": "0.0.1-dev.22",
4
4
  "type": "module",
5
5
  "description": "paas 平台核心包",
6
6
  "main": "dist/index.min.cjs",
@@ -56,8 +56,8 @@
56
56
  "vue-i18n": "9.6.5"
57
57
  },
58
58
  "devDependencies": {
59
- "@gct-paas/build": "0.0.1-dev.21",
60
- "@gct-paas/cli": "0.0.1-dev.21",
59
+ "@gct-paas/build": "0.0.1-dev.22",
60
+ "@gct-paas/cli": "0.0.1-dev.22",
61
61
  "@types/path-browserify": "^1.0.3",
62
62
  "@types/qs": "^6.9.18",
63
63
  "fs-extra": "^11.3.0"
@@ -65,5 +65,5 @@
65
65
  "peerDependencies": {
66
66
  "vue": "^3.x"
67
67
  },
68
- "gitHead": "37b40934f0d80ca67b4dba1c0259e8ca02f9dba5"
68
+ "gitHead": "01a20754acef24cd3e6bb4b8b57687cd65e5fe92"
69
69
  }