👷 Updates router to use the new format of Config Accumulator

This commit is contained in:
Alicia Sykes 2021-07-04 09:04:21 +01:00
parent ec95fafe04
commit 3de9beee41
1 changed files with 9 additions and 13 deletions

View File

@ -6,13 +6,13 @@ import Login from '@/views/Login.vue';
import Workspace from '@/views/Workspace.vue'; import Workspace from '@/views/Workspace.vue';
import DownloadConfig from '@/views/DownloadConfig.vue'; import DownloadConfig from '@/views/DownloadConfig.vue';
import { isLoggedIn } from '@/utils/Auth'; import { isLoggedIn } from '@/utils/Auth';
import { appConfig, pageInfo, sections } from '@/utils/ConfigAccumalator'; import { config } from '@/utils/ConfigHelpers';
import { metaTagData } from '@/utils/defaults'; import { metaTagData } from '@/utils/defaults';
Vue.use(Router); Vue.use(Router);
const isAuthenticated = () => { const isAuthenticated = () => {
const users = appConfig.auth; const users = config.appConfig.auth;
return (!users || isLoggedIn(users)); return (!users || isLoggedIn(users));
}; };
@ -22,13 +22,9 @@ const router = new Router({
path: '/', path: '/',
name: 'home', name: 'home',
component: Home, component: Home,
props: { props: config,
appConfig,
pageInfo,
sections,
},
meta: { meta: {
title: pageInfo.title || 'Home Page', title: config.pageInfo.title || 'Home Page',
metaTags: metaTagData, metaTags: metaTagData,
}, },
}, },
@ -36,9 +32,9 @@ const router = new Router({
path: '/workspace', path: '/workspace',
name: 'workspace', name: 'workspace',
component: Workspace, component: Workspace,
props: { appConfig, pageInfo, sections }, props: config,
meta: { meta: {
title: pageInfo.title || 'Dashy Workspace', title: config.pageInfo.title || 'Dashy Workspace',
metaTags: metaTagData, metaTags: metaTagData,
}, },
}, },
@ -47,7 +43,7 @@ const router = new Router({
name: 'login', name: 'login',
component: Login, component: Login,
props: { props: {
appConfig, appConfig: config.appConfig,
}, },
beforeEnter: (to, from, next) => { beforeEnter: (to, from, next) => {
if (isAuthenticated()) router.push({ path: '/' }); if (isAuthenticated()) router.push({ path: '/' });
@ -63,9 +59,9 @@ const router = new Router({
path: '/download', path: '/download',
name: 'download', name: 'download',
component: DownloadConfig, component: DownloadConfig,
props: { appConfig, pageInfo, sections }, props: config,
meta: { meta: {
title: pageInfo.title || 'Download Dashy Config', title: config.pageInfo.title || 'Download Dashy Config',
metaTags: metaTagData, metaTags: metaTagData,
}, },
}, },