Add guard for undefined values
This change fixes a lint encountered where the parameter provided to the
callback could be undefined.
@@ -110,6 +110,7 @@ const router = new Router({
});
router.beforeEach((to, from, next) => {
+ if (to && to.meta) {
store.commit('pageLoading/setPageLoading', to.meta.loadingMessage);
if (to.meta.requiresAuth) {
if (!store.getters['user/isLoggedIn']) {
@@ -119,6 +120,7 @@ router.beforeEach((to, from, next) => {
}
}
next();
+ }
});
router.afterEach((to, from) => {
