fix(store): store内引用项目本身 router

This commit is contained in:
baiqi 2024-07-10 10:38:27 +08:00 committed by Craftsman
parent 877d9d473d
commit 59ee108a09
2 changed files with 2 additions and 4 deletions

View File

@ -1,4 +1,3 @@
import { useRouter } from 'vue-router';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { Notification } from '@arco-design/web-vue'; import { Notification } from '@arco-design/web-vue';
import { cloneDeep } from 'lodash-es'; import { cloneDeep } from 'lodash-es';
@ -13,6 +12,7 @@ import { getPackageType, getSystemVersion } from '@/api/modules/system';
import { getMenuList } from '@/api/modules/user'; import { getMenuList } from '@/api/modules/user';
import defaultSettings from '@/config/settings.json'; import defaultSettings from '@/config/settings.json';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import router from '@/router';
import { NO_PROJECT_ROUTE_NAME } from '@/router/constants'; import { NO_PROJECT_ROUTE_NAME } from '@/router/constants';
import { watchStyle, watchTheme } from '@/utils/theme'; import { watchStyle, watchTheme } from '@/utils/theme';
@ -262,7 +262,6 @@ const useAppStore = defineStore('app', {
} }
const res = await getProjectInfo(this.currentProjectId); const res = await getProjectInfo(this.currentProjectId);
if (!res || res.deleted) { if (!res || res.deleted) {
const router = useRouter();
router.push({ router.push({
name: NO_PROJECT_ROUTE_NAME, name: NO_PROJECT_ROUTE_NAME,
}); });

View File

@ -1,4 +1,3 @@
import { useRouter } from 'vue-router';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { getProjectInfo } from '@/api/modules/project-management/project'; import { getProjectInfo } from '@/api/modules/project-management/project';
@ -12,6 +11,7 @@ import {
} from '@/api/modules/user'; } from '@/api/modules/user';
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useUser from '@/hooks/useUser'; import useUser from '@/hooks/useUser';
import router from '@/router';
import { NO_PROJECT_ROUTE_NAME } from '@/router/constants'; import { NO_PROJECT_ROUTE_NAME } from '@/router/constants';
import useLicenseStore from '@/store/modules/setting/license'; import useLicenseStore from '@/store/modules/setting/license';
import { getHashParameters, getQueryVariable } from '@/utils'; import { getHashParameters, getQueryVariable } from '@/utils';
@ -238,7 +238,6 @@ const useUserStore = defineStore('user', {
} }
}, },
async checkIsLogin(forceSet = false) { async checkIsLogin(forceSet = false) {
const router = useRouter();
const { isLoginPage } = useUser(); const { isLoginPage } = useUser();
const appStore = useAppStore(); const appStore = useAppStore();
const isLogin = await this.isLogin(forceSet); const isLogin = await this.isLogin(forceSet);