FOrmat and disable server store temporarily
This commit is contained in:
parent
d0348a4505
commit
8b3713e3ff
|
@ -1,8 +1,6 @@
|
||||||
import VueRouter from 'vue-router';
|
import VueRouter from 'vue-router';
|
||||||
import store from './store/index';
|
import store from './store/index';
|
||||||
import compareDate from 'date-fns/compare_asc'
|
|
||||||
import addHours from 'date-fns/add_hours'
|
|
||||||
import dateParse from 'date-fns/parse'
|
|
||||||
const route = require('./../../../vendor/tightenco/ziggy/src/js/route').default;
|
const route = require('./../../../vendor/tightenco/ziggy/src/js/route').default;
|
||||||
|
|
||||||
// Base Vuejs Templates
|
// Base Vuejs Templates
|
||||||
|
@ -13,22 +11,22 @@ import ResetPassword from './components/auth/ResetPassword';
|
||||||
import User from './models/user';
|
import User from './models/user';
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{ name: 'login', path: '/auth/login', component: Login },
|
{name: 'login', path: '/auth/login', component: Login},
|
||||||
{ name: 'forgot-password', path: '/auth/password', component: Login },
|
{name: 'forgot-password', path: '/auth/password', component: Login},
|
||||||
{ name: 'checkpoint', path: '/auth/checkpoint', component: Login },
|
{name: 'checkpoint', path: '/auth/checkpoint', component: Login},
|
||||||
{
|
{
|
||||||
name: 'reset-password',
|
name: 'reset-password',
|
||||||
path: '/auth/password/reset/:token',
|
path: '/auth/password/reset/:token',
|
||||||
component: ResetPassword,
|
component: ResetPassword,
|
||||||
props: function (route) {
|
props: function (route) {
|
||||||
return { token: route.params.token, email: route.query.email || '' };
|
return {token: route.params.token, email: route.query.email || ''};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
{ name : 'dashboard', path: '/', component: Dashboard },
|
{name: 'dashboard', path: '/', component: Dashboard},
|
||||||
{ name : 'account', path: '/account', component: Account },
|
{name: 'account', path: '/account', component: Account},
|
||||||
{ name : 'account.api', path: '/account/api', component: Account },
|
{name: 'account.api', path: '/account/api', component: Account},
|
||||||
{ name : 'account.security', path: '/account/security', component: Account },
|
{name: 'account.security', path: '/account/security', component: Account},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: 'server',
|
name: 'server',
|
||||||
|
@ -48,6 +46,7 @@ const router = new VueRouter({
|
||||||
// have no JWT or the JWT is expired and wouldn't be accepted by the Panel.
|
// have no JWT or the JWT is expired and wouldn't be accepted by the Panel.
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
if (to.path === route('auth.logout')) {
|
if (to.path === route('auth.logout')) {
|
||||||
|
console.log('logging out');
|
||||||
return window.location = route('auth.logout');
|
return window.location = route('auth.logout');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,11 +54,13 @@ router.beforeEach((to, from, next) => {
|
||||||
|
|
||||||
// Check that if we're accessing a non-auth route that a user exists on the page.
|
// Check that if we're accessing a non-auth route that a user exists on the page.
|
||||||
if (!to.path.startsWith('/auth') && !(user instanceof User)) {
|
if (!to.path.startsWith('/auth') && !(user instanceof User)) {
|
||||||
|
console.log('logging out 2');
|
||||||
store.commit('auth/logout');
|
store.commit('auth/logout');
|
||||||
return window.location = route('auth.logout');
|
return window.location = route('auth.logout');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Continue on through the pipeline.
|
// Continue on through the pipeline.
|
||||||
|
console.log('continuing');
|
||||||
return next();
|
return next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -7,16 +7,16 @@ Vue.use(Vuex);
|
||||||
|
|
||||||
const store = new Vuex.Store({
|
const store = new Vuex.Store({
|
||||||
strict: process.env.NODE_ENV !== 'production',
|
strict: process.env.NODE_ENV !== 'production',
|
||||||
modules: { auth, server },
|
modules: { auth },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (module.hot) {
|
if (module.hot) {
|
||||||
module.hot.accept(['./modules/auth'], () => {
|
module.hot.accept(['./modules/auth'], () => {
|
||||||
const newAuthModule = require('./modules/auth').default;
|
const newAuthModule = require('./modules/auth').default;
|
||||||
const newServerModule = require('./modules/server').default;
|
// const newServerModule = require('./modules/server').default;
|
||||||
|
|
||||||
store.hotUpdate({
|
store.hotUpdate({
|
||||||
modules: { newAuthModule, newServerModule },
|
modules: { newAuthModule },
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue