diff --git a/src/permission.js b/src/permission.js index d1d37f428..532d6e3c4 100644 --- a/src/permission.js +++ b/src/permission.js @@ -3,7 +3,7 @@ import store from '@/store'; import router from './router'; import NProgress from 'nprogress'; import { admin} from './router'; -import { getToken} from '@/utils/auth'; +import { getToken, removeToken} from '@/utils/auth'; import { LoginParams } from '@/utils/login'; import { getSessionStorage } from '@/utils/auth'; import localStore from 'storejs'; @@ -43,12 +43,20 @@ function getRouteInfo(to) { } else if (isDesignPage(toRoutePath)) { loginPath = getSessionStorage('project') === 'designxty' ? loginDesignXtyPage : loginDesignPage; clientId = LoginParams.Design.clientId; + const current_session = getSessionStorage('project'); + if (current_session && !current_session.startsWith('design')) { + removeToken(); + } } else if ( /^\/xty/.test(toRoutePath)) { loginPath = loginXtyPage; clientId = null; } else { loginPath = getSessionStorage('project') === 'xty' ? loginXtyPage : loginPage; clientId = null; + const current_session = getSessionStorage('project'); + if (current_session && current_session.startsWith('design')) { + removeToken(); + } } return { clientId, loginPath };