mirror of
https://github.com/Lissy93/dashy.git
synced 2024-12-29 03:45:20 +03:00
Fixes pageInfo not being read in router (#645)
This commit is contained in:
parent
24e487cde5
commit
9b33a6e277
@ -11,7 +11,6 @@ import { Progress } from 'rsup-progress';
|
||||
|
||||
// Import views, that are not lazy-loaded
|
||||
import Home from '@/views/Home.vue';
|
||||
import ConfigAccumulator from '@/utils/ConfigAccumalator';
|
||||
|
||||
// Import helper functions, config data and defaults
|
||||
import { isAuthEnabled, isLoggedIn, isGuestAccessEnabled } from '@/utils/Auth';
|
||||
@ -19,7 +18,8 @@ import { makePageSlug, makePageName } from '@/utils/ConfigHelpers';
|
||||
import { metaTagData, startingView, routePaths } from '@/utils/defaults';
|
||||
import ErrorHandler from '@/utils/ErrorHandler';
|
||||
|
||||
import { pages } from '../public/conf.yml';
|
||||
// Import data from users conf file. Note that rebuild is required for this to update.
|
||||
import { pages, pageInfo, appConfig } from '../public/conf.yml';
|
||||
|
||||
Vue.use(Router);
|
||||
const progress = new Progress({ color: 'var(--progress-bar)' });
|
||||
@ -32,17 +32,6 @@ const isAuthenticated = () => {
|
||||
return (!authEnabled || userLoggedIn || guestEnabled);
|
||||
};
|
||||
|
||||
const getConfig = () => {
|
||||
const Accumulator = new ConfigAccumulator();
|
||||
return {
|
||||
appConfig: Accumulator.appConfig(),
|
||||
pageInfo: Accumulator.pageInfo(),
|
||||
pages: Accumulator.pages(),
|
||||
};
|
||||
};
|
||||
|
||||
const { appConfig, pageInfo } = getConfig();
|
||||
|
||||
/* Get the users chosen starting view from app config, or return default */
|
||||
const getStartingView = () => appConfig.startingView || startingView;
|
||||
|
||||
@ -61,7 +50,7 @@ const getStartingComponent = () => {
|
||||
|
||||
/* Returns the meta tags for each route */
|
||||
const makeMetaTags = (defaultTitle) => ({
|
||||
title: pageInfo.title || defaultTitle,
|
||||
title: pageInfo?.title || defaultTitle,
|
||||
metaTags: metaTagData,
|
||||
});
|
||||
|
||||
@ -73,10 +62,12 @@ const makeSubConfigPath = (rawPath) => {
|
||||
|
||||
/* For each additional config file, create routes for home, minimal and workspace views */
|
||||
const makeMultiPageRoutes = (userPages) => {
|
||||
if (!userPages) return [];
|
||||
// If no multi pages specified, or is not array, then return nothing
|
||||
if (!userPages || !Array.isArray(userPages)) return [];
|
||||
const multiPageRoutes = [];
|
||||
// For each user page, create an additional route
|
||||
userPages.forEach((page) => {
|
||||
if (!page.name || !page.path) {
|
||||
if (!page.name || !page.path) { // Sumin not right, show warning
|
||||
ErrorHandler('Additional pages must have both a `name` and `path`');
|
||||
}
|
||||
// Props to be passed to home mixin
|
||||
|
Loading…
Reference in New Issue
Block a user