import One from '..' /** * 初始化 Tenant */ export default function pluginTenant ($: One) { const { storage } = $ const tenantKeys = [ 'sdp-app-id', 'sdp-migrated', 'vorg', 'Orgname', 'sdp-user-id', 'sdp-node-id', 'service-tenant-id', 'sdp-biz-type' ] $.getTenant = () => { return tenantKeys.reduce((obj, key) => { const value = storage.get(key) if (value !== '' && value !== undefined && value !== null) { return Object.assign(obj, { [key]: value }) } return obj }, {}) } } // 无需异步 export function asyncPluginTenant ($: One) { pluginTenant($) }