12345678910111213141516171819202122232425262728293031323334353637 |
- import Report from "./../pages/report.vue"
- import Login from "./../pages/login.vue"
- import AccountsReceivable from "./../pages/accountsReceivable.vue"
- import Results from "./../pages/results.vue"
- import NewReport from "./../pages/newReport.vue"
- import Stock from "./../pages/stock.vue"
- import Index from "../pages/index.vue"
- import { getParameterByName } from "../utils/auth"
- const routes = [
- { path:"/", component: Index },
- { path: '/report', component: Report},
- { path:'/login', component: Login},
- { path:'/newReport', component: NewReport},
- { path:'/results', component: Results},
- { path:'/accountsReceivable', component: AccountsReceivable},
- { path:'/stock', component: Stock},
- ]
- const router = new VueRouter({routes ,mode:'hash'})
- router.beforeEach((to, _, next) => {
- const path = getParameterByName('path')
- if(to.path === "/" && !path){
- next()
- }else if (to.path !== '/login' && !getParameterByName('code')) {
- next({
- path:'login',
- query:{ path }
- })
- } else {
- next()
- }
- })
- export default router
|