This commit is contained in:
AceDataCloud committed 2023-09-25 20:54:31 +08:00
1 parent d206c7df38
commit affd47193c
14 files changed
+73 -160

No files matched your search

+2 -17
View File
@@ -2,6 +2,7 @@ import { createRouter, createWebHistory } from 'vue-router';
import auth from './auth';
import conversation from './conversation';
import store from '@/store';
import chat from './chat';
import { ROUTE_AUTH_LOGIN, ROUTE_CONVERSATION_NEW, ROUTE_INDEX } from './constants';
const routes = [
@@ -12,8 +13,7 @@ const routes = [
name: ROUTE_CONVERSATION_NEW
}
},
auth,
conversation
chat
];
const router = createRouter({
@@ -21,21 +21,6 @@ const router = createRouter({
routes
});
router.beforeEach((to, from, next) => {
if (to.matched.some((record) => record.meta.auth)) {
if (!store.getters.authenticated) {
next({
name: ROUTE_AUTH_LOGIN,
query: { redirect: to.fullPath }
});
} else {
next();
}
} else {
next();
}
});
export default router;
export * from './constants';