fix: 修复自动切换到 root org 回不来的问题

This commit is contained in:
ibuler
2024-05-10 15:49:35 +08:00
committed by 老广
parent 7b62ce2d33
commit 7602d6e270
2 changed files with 10 additions and 1 deletions

View File

@@ -1,5 +1,7 @@
import { getProfile as apiGetProfile, logout } from '@/api/users'
import { getCurrentOrgLocal, getPreOrgLocal, getTokenFromCookie, saveCurrentOrgLocal, setPreOrgLocal } from '@/utils/auth'
import {
getCurrentOrgLocal, getPreOrgLocal, getTokenFromCookie, saveCurrentOrgLocal, setPreOrgLocal
} from '@/utils/auth'
import orgUtil from '@/utils/org'
import { resetRouter } from '@/router'
import Vue from 'vue'
@@ -157,6 +159,7 @@ const actions = {
const globalOrg = {
id: orgUtil.GLOBAL_ORG_ID,
name: 'Global',
is_root: true,
autoEnter: true
}
commit('SET_CURRENT_ORG', globalOrg)

View File

@@ -65,6 +65,12 @@ async function changeCurrentOrgIfNeed({ to, from, next }) {
await orgUtil.changeOrg(preOrg)
return
}
if (currentOrg.is_root && !currentOrg.autoEnter) {
setTimeout(() => {
orgUtil.change2PropOrg({ to, from, next })
}, 1000)
return
}
if (!orgUtil.hasCurrentOrgPermission()) {
Vue.$log.error('Not has current org permission: ', currentOrg)
await orgUtil.change2PropOrg({ to, from, next })