import {createRouter, createWebHashHistory} from 'vue-router'; import axiosStore from '../uilts/AxiosStore'; import {getStaff} from "../uilts/storage"; const routes: any = [ { path: '/', redirect: '/Login'}, { path: '/Login', component: () => import('../components/Login.vue') }, { path: '/MicrowaveRadiation', component: () => import('../components/MicrowaveRadiation.vue') }, { path: '/RamanLidar', component: () => import('../components/RamanLidar.vue') }, { path: '/SynergyEvaluation', component: () => import('../components/SynergyEvaluation.vue') }, { path: '/DecisionSupport', component: () => import('../components/DecisionSupport.vue') }, { path: '/SystemManagement', component: () => import('../components/SystemManagement.vue') } ]; const router = createRouter({ history: createWebHashHistory(), routes, linkActiveClass: 'active' }) router.beforeEach((to,form,next)=>{ if (getStaff('login_staff')){ axiosStore._axiosPromiseCancel.forEach(e=>{ e && e() }); axiosStore._axiosPromiseCancel = []; next() }else { if (to.path =="/Login"){ next() }else { next('/Login') } } }) export default router;