@alicloud/console-base-conf-parse-account
Advanced tools
Comparing version 1.3.0 to 1.3.2
@@ -10,3 +10,2 @@ "use strict"; | ||
exports.EAccountType = EAccountType; | ||
(function (EAccountType) { | ||
@@ -13,0 +12,0 @@ EAccountType["MAIN"] = "main"; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -20,5 +19,3 @@ value: true | ||
}); | ||
var _parseAccount = _interopRequireDefault(require("./util/parse-account")); | ||
var _enum = require("./enum"); |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -9,9 +8,5 @@ value: true | ||
exports.default = parseAccount; | ||
var _cookie = require("@alicloud/cookie"); | ||
var _consoleOneConfig = _interopRequireDefault(require("@alicloud/console-one-config")); | ||
var _enum = require("../enum"); | ||
/** | ||
@@ -22,10 +17,8 @@ * 拿到账号相关的信息,注意可能不准,所以除了埋点相关,不要做任何其他有用途 | ||
var _ref = window, | ||
ALIYUN_ECS_CONSOLE_CONFIG = _ref.ALIYUN_ECS_CONSOLE_CONFIG; | ||
ALIYUN_ECS_CONSOLE_CONFIG = _ref.ALIYUN_ECS_CONSOLE_CONFIG; | ||
var userId = ''; // 当前登录用户 ID | ||
var userIdMain = ''; // 当前登录用户(如果是子账号)的主账号的 ID,如果当前登录是主账号,则直接跟 userId 一样 | ||
var userType = _enum.EAccountType.MAIN; // 用户类型 | ||
var userType = _enum.EAccountType.MAIN; // 用户类型 | ||
// 预先从控制台自己的配置项中拿主子账号的 ID,因为 cookie 不靠谱 | ||
if (_consoleOneConfig.default.ONE) { | ||
@@ -40,3 +33,2 @@ // OneConsole 的场景 | ||
userIdMain = ALIYUN_ECS_CONSOLE_CONFIG.MASTER_PK; | ||
if (ALIYUN_ECS_CONSOLE_CONFIG.isChildAccount) { | ||
@@ -48,2 +40,3 @@ userType = _enum.EAccountType.RAM; | ||
} | ||
/* | ||
@@ -54,7 +47,4 @@ * 我告诉你为什么 cookie 不靠谱: | ||
*/ | ||
if (!userId) { | ||
userId = (0, _cookie.getCookie)('login_aliyunid_pk') || ''; | ||
if (!userId) { | ||
@@ -61,0 +51,0 @@ userType = _enum.EAccountType.RAM; // 不准 |
// eslint-disable-next-line import/prefer-default-export | ||
export var EAccountType; | ||
(function (EAccountType) { | ||
@@ -5,0 +4,0 @@ EAccountType["MAIN"] = "main"; |
import { getCookie } from '@alicloud/cookie'; | ||
import ONE_CONF from '@alicloud/console-one-config'; | ||
import { EAccountType } from '../enum'; | ||
/** | ||
@@ -10,10 +9,8 @@ * 拿到账号相关的信息,注意可能不准,所以除了埋点相关,不要做任何其他有用途 | ||
var _ref = window, | ||
ALIYUN_ECS_CONSOLE_CONFIG = _ref.ALIYUN_ECS_CONSOLE_CONFIG; | ||
ALIYUN_ECS_CONSOLE_CONFIG = _ref.ALIYUN_ECS_CONSOLE_CONFIG; | ||
var userId = ''; // 当前登录用户 ID | ||
var userIdMain = ''; // 当前登录用户(如果是子账号)的主账号的 ID,如果当前登录是主账号,则直接跟 userId 一样 | ||
var userType = EAccountType.MAIN; // 用户类型 | ||
var userType = EAccountType.MAIN; // 用户类型 | ||
// 预先从控制台自己的配置项中拿主子账号的 ID,因为 cookie 不靠谱 | ||
if (ONE_CONF.ONE) { | ||
@@ -28,3 +25,2 @@ // OneConsole 的场景 | ||
userIdMain = ALIYUN_ECS_CONSOLE_CONFIG.MASTER_PK; | ||
if (ALIYUN_ECS_CONSOLE_CONFIG.isChildAccount) { | ||
@@ -36,2 +32,3 @@ userType = EAccountType.RAM; | ||
} | ||
/* | ||
@@ -42,7 +39,4 @@ * 我告诉你为什么 cookie 不靠谱: | ||
*/ | ||
if (!userId) { | ||
userId = getCookie('login_aliyunid_pk') || ''; | ||
if (!userId) { | ||
@@ -49,0 +43,0 @@ userType = EAccountType.RAM; // 不准 |
{ | ||
"name": "@alicloud/console-base-conf-parse-account", | ||
"version": "1.3.0", | ||
"version": "1.3.2", | ||
"description": "ConsoleBase CONF.ACCOUNT parse", | ||
@@ -10,3 +10,3 @@ "license": "MIT", | ||
"types": "build/types/index.d.ts", | ||
"homepage": "https://github.com/aliyun/alibabacloud-console-base/tree/master/packages/console-base-conf-parse-account", | ||
"homepage": "https://github.com/aliyun/alibabacloud-console-base/tree/master/packages-conf/console-base-conf-parse-account", | ||
"author": { | ||
@@ -34,7 +34,7 @@ "name": "Jianchun Wang", | ||
"react": "^17.0.2", | ||
"typescript": "^4.7.4" | ||
"typescript": "^4.8.4" | ||
}, | ||
"dependencies": { | ||
"@alicloud/console-one-config": "^1.4.0", | ||
"@alicloud/cookie": "^1.4.0" | ||
"@alicloud/console-one-config": "^1.4.2", | ||
"@alicloud/cookie": "^1.4.2" | ||
}, | ||
@@ -52,3 +52,3 @@ "scripts": { | ||
}, | ||
"gitHead": "3a50c1eaa823efebfa79bb16a5e042c6dfbb8bb5" | ||
"gitHead": "4b5eefd0215b1f8028fce664d64484ceeb703ef1" | ||
} |
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
0
9046