const.js
792 Bytes
const GLOBAL_STORAGE_KEY = (() => {
const isDEV = location.href.includes('dev=1')
const DEVELOPMENT = 'DEVELOPMENT'
const PRODUCTION = 'PRODUCTION'
return `UNDEFINED__${isDEV ? DEVELOPMENT : PRODUCTION}__2.7.1__COMMON__LOCAL__KEY__`
})()
const GLOBAL_TOKEN = (() => {
const ls = createStorage({ storage: localStorage })
/**
* @description user info
* @type {{JWT_TOKEN: {value: string}}}
*/
const common = ls.get(GLOBAL_STORAGE_KEY)
return {
token: common && common.JWT_TOKEN && common.JWT_TOKEN.value,
refreshToken: common && common.JWT_TOKEN && common.JWT_TOKEN.value,
}
})()
const GLOBAL_WS_URL = () => {
const { host, href } = location
const reg = /^https/
return `${reg.test(href) ? 'wss' : 'ws'}://${host}/api/ws/plugins/telemetry?token=${GLOBAL_TOKEN.token}`
}