Browse Source

修改 auth.js 文件中的 getTenant方法

zhuangdezheng 1 year ago
parent
commit
c75a0e189d
1 changed files with 2 additions and 2 deletions
  1. 2 2
      src/utils/auth.js

+ 2 - 2
src/utils/auth.js

@@ -18,8 +18,8 @@ export function removeToken() {
 const TenantKey = 'Tenant-Key'
 const TenantKey = 'Tenant-Key'
 
 
 export function getTenant() {
 export function getTenant() {
-  const tenantInfo = JSON.parse(Cookies.get(TenantKey))
-  return tenantInfo
+  const cookieTenant = Cookies.get(TenantKey)
+  return cookieTenant ? JSON.parse(cookieTenant) : null
 }
 }
 
 
 export function setTenant(tenant) {
 export function setTenant(tenant) {