WIP Progress on skeleton of the Vue app.

This commit is contained in:
2019-03-04 18:46:54 -06:00
parent bcde5fbfc0
commit 1b94245078
37 changed files with 536 additions and 256 deletions

View File

@ -6,8 +6,7 @@ import Login from '@/views/Login.vue';
import Measures from '@/views/Measures.vue';
import UserAccount from '@/views/UserAccount.vue';
import QuickPanels from '@/views/QuickPanels.vue';
import userService from '@/services/user';
import userStore from '@/store-modules/user';
Vue.use(Router);
@ -54,10 +53,9 @@ const router = new Router({
// Auth filter
router.beforeEach((to, from, next) => {
if (to.matched.some((record) => record.meta.requiresAuth)) {
if (!userService.isAuthed()) {
next({
path: '/login',
params: { nextUrl: to.fullPath } });
if (!userStore.user || !userStore.user.authToken) {
next({ name: 'login' });
// params: { redirect: to.path } });
} else { next(); } // if authed
} else { next(); } // if auth required
});