WIP Auth redesign.

This commit is contained in:
2019-03-07 23:39:24 -06:00
parent 6bc094f515
commit b23d3d36af
18 changed files with 188 additions and 51 deletions

View File

@ -6,7 +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 userStore from '@/store-modules/user';
import authStore from '@/store-modules/auth';
Vue.use(Router);
@ -16,7 +16,7 @@ const router = new Router({
routes: [
{
path: '/',
redirect: '/dashboard'
redirect: '/measures'
},
{
path: '/login',
@ -53,7 +53,7 @@ const router = new Router({
// Auth filter
router.beforeEach((to, from, next) => {
if (to.matched.some((record) => record.meta.requiresAuth)) {
if (!userStore.user || !userStore.user.authToken) {
if (!authStore.authToken) {
next({ name: 'login' });
// params: { redirect: to.path } });
} else { next(); } // if authed