fix(切换组织): 切换到无项目的组织问题修复

This commit is contained in:
baiqi 2024-07-19 11:14:43 +08:00 committed by 刘瑞斌
parent 1d145dd6e6
commit 782b1bea86
2 changed files with 9 additions and 1 deletions

View File

@ -274,7 +274,9 @@ const useAppStore = defineStore('app', {
return;
}
const res = await getProjectInfo(this.currentProjectId);
if (!res || res.deleted) {
const routeName = router.currentRoute.value.name as string;
if ((!res || res.deleted) && !routeName?.includes('setting')) {
// 如果没有项目信息,且访问的不是系统设置下的页面,则跳转到无项目页面
router.push({
name: NO_PROJECT_ROUTE_NAME,
});

View File

@ -271,6 +271,12 @@ const useUserStore = defineStore('user', {
// eslint-disable-next-line no-console
console.log(err);
}
} else if (isLogin && appStore.currentProjectId === 'no_such_project') {
// 切换组织后,可能存在组织无项目情况,此时需要跳转到无项目权限页面
router.push({
name: NO_PROJECT_ROUTE_NAME,
});
throw new Error('no project');
}
if (isLoginPage() && isLogin) {
// 当前页面为登录页面,且已经登录,跳转到首页