inital commit
This commit is contained in:
80
resources/js/router/index.js
vendored
Normal file
80
resources/js/router/index.js
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import routes from './routes'
|
||||
import store from './../store'
|
||||
import {getStep} from "../helper";
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(APP_BASE_ROUTE),
|
||||
routes: routes
|
||||
})
|
||||
|
||||
function isAuthenticated() {
|
||||
return store.getters['auth/authenticated'];
|
||||
}
|
||||
|
||||
router.beforeEach((to, from, next) => {
|
||||
/*if (!isAuthenticated() && to.matched.some(record => record.meta.requires_auth)) {
|
||||
next({ name: 'login' })
|
||||
} else if (isAuthenticated() && to.matched.some(record => record.meta.is_auth_route)) {
|
||||
next({ name: 'dashboard' })
|
||||
}
|
||||
|
||||
next()*/
|
||||
const step = getStep();
|
||||
// console.clear()
|
||||
// console.log(from.path,to.path)
|
||||
if(to.name == "add-profile"){
|
||||
if(!step){
|
||||
next({name:'create-account'})
|
||||
}else if(step == 3){
|
||||
next({name:'choose-package'})
|
||||
}else if(step == 4){
|
||||
next({name:'create-cr-account'})
|
||||
}
|
||||
}else if(to.name == "choose-package"){
|
||||
if(!step){
|
||||
next({name:'create-account'})
|
||||
}else if(step == 2){
|
||||
next({name:'add-profile'})
|
||||
}else if(step == 4){
|
||||
next({name:'create-cr-account'})
|
||||
}
|
||||
}else if(to.name == "create-account") {
|
||||
if(step == 2){
|
||||
next({name:'add-profile'})
|
||||
}else if(step == 3){
|
||||
next({name:'choose-package'})
|
||||
}else if(step == 4){
|
||||
next({name:'create-cr-account'})
|
||||
}
|
||||
}else if(to.name == "success"){
|
||||
if(!step){
|
||||
next({name:'create-account'})
|
||||
}
|
||||
}else if(to.name == "create-cr-account"){
|
||||
if(!step){
|
||||
next({name:'create-account'})
|
||||
}else if(step == 2){
|
||||
next({name:'add-profile'})
|
||||
}else if(step == 3){
|
||||
next({name:'choose-package'})
|
||||
}else if(step == 5){
|
||||
next({name:'make-payment'})
|
||||
}
|
||||
}else if(to.name == "make-payment"){
|
||||
if(!step){
|
||||
next({name:'create-account'})
|
||||
}else if(step == 2){
|
||||
next({name:'add-profile'})
|
||||
}else if(step == 3){
|
||||
next({name:'choose-package'})
|
||||
}else if(step == 4){
|
||||
next({name:'create-cr-account'})
|
||||
}
|
||||
}
|
||||
|
||||
next()
|
||||
|
||||
})
|
||||
|
||||
export default router
|
||||
Reference in New Issue
Block a user