Explorar el Código

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

zhuangdezheng hace 1 año
padre
commit
c75a0e189d
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      src/utils/auth.js

+ 2 - 2
src/utils/auth.js

@@ -18,8 +18,8 @@ export function removeToken() {
 const TenantKey = 'Tenant-Key'
 
 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) {