11import VueRouter from 'vue-router' ;
22import store from './store/index' ;
3- import compareDate from 'date-fns/compare_asc'
4- import addHours from 'date-fns/add_hours'
5- import dateParse from 'date-fns/parse'
3+
64const route = require ( './../../../vendor/tightenco/ziggy/src/js/route' ) . default ;
75
86// Base Vuejs Templates
@@ -13,22 +11,22 @@ import ResetPassword from './components/auth/ResetPassword';
1311import User from './models/user' ;
1412
1513const routes = [
16- { name : 'login' , path : '/auth/login' , component : Login } ,
17- { name : 'forgot-password' , path : '/auth/password' , component : Login } ,
18- { name : 'checkpoint' , path : '/auth/checkpoint' , component : Login } ,
14+ { name : 'login' , path : '/auth/login' , component : Login } ,
15+ { name : 'forgot-password' , path : '/auth/password' , component : Login } ,
16+ { name : 'checkpoint' , path : '/auth/checkpoint' , component : Login } ,
1917 {
2018 name : 'reset-password' ,
2119 path : '/auth/password/reset/:token' ,
2220 component : ResetPassword ,
2321 props : function ( route ) {
24- return { token : route . params . token , email : route . query . email || '' } ;
22+ return { token : route . params . token , email : route . query . email || '' } ;
2523 }
2624 } ,
2725
28- { name : 'dashboard' , path : '/' , component : Dashboard } ,
29- { name : 'account' , path : '/account' , component : Account } ,
30- { name : 'account.api' , path : '/account/api' , component : Account } ,
31- { name : 'account.security' , path : '/account/security' , component : Account } ,
26+ { name : 'dashboard' , path : '/' , component : Dashboard } ,
27+ { name : 'account' , path : '/account' , component : Account } ,
28+ { name : 'account.api' , path : '/account/api' , component : Account } ,
29+ { name : 'account.security' , path : '/account/security' , component : Account } ,
3230
3331 {
3432 name : 'server' ,
@@ -48,18 +46,21 @@ const router = new VueRouter({
4846// have no JWT or the JWT is expired and wouldn't be accepted by the Panel.
4947router . beforeEach ( ( to , from , next ) => {
5048 if ( to . path === route ( 'auth.logout' ) ) {
49+ console . log ( 'logging out' ) ;
5150 return window . location = route ( 'auth.logout' ) ;
5251 }
5352
5453 const user = store . getters [ 'auth/getUser' ] ;
5554
5655 // Check that if we're accessing a non-auth route that a user exists on the page.
5756 if ( ! to . path . startsWith ( '/auth' ) && ! ( user instanceof User ) ) {
57+ console . log ( 'logging out 2' ) ;
5858 store . commit ( 'auth/logout' ) ;
5959 return window . location = route ( 'auth.logout' ) ;
6060 }
6161
6262 // Continue on through the pipeline.
63+ console . log ( 'continuing' ) ;
6364 return next ( ) ;
6465} ) ;
6566
0 commit comments