Completes basic functionality for UI configuration
This commit is contained in:
@@ -27,7 +27,13 @@ export default {
|
||||
/* Returns either page info from the config, or default values */
|
||||
getPageInfo(pageInfo) {
|
||||
const defaults = Defaults.pageInfo;
|
||||
const localPageInfo = JSON.parse(localStorage[localStorageKeys.PAGE_INFO]);
|
||||
|
||||
let localPageInfo;
|
||||
try {
|
||||
localPageInfo = JSON.parse(localStorage[localStorageKeys.PAGE_INFO]);
|
||||
} catch (e) {
|
||||
localPageInfo = {};
|
||||
}
|
||||
if (pageInfo) {
|
||||
return {
|
||||
title: localPageInfo.title || pageInfo.title || defaults.title,
|
||||
|
||||
@@ -36,6 +36,7 @@ export default {
|
||||
pageInfo.footerText = this.formElements.footerText;
|
||||
localStorage.setItem(localStorageKeys.PAGE_INFO, JSON.stringify(pageInfo));
|
||||
this.$toasted.show('Changes seved succesfully');
|
||||
setTimeout(() => { location.reload(); }, 1500); // eslint-disable-line no-restricted-globals
|
||||
},
|
||||
},
|
||||
data() {
|
||||
|
||||
@@ -2,11 +2,17 @@ import Vue from 'vue';
|
||||
import Router from 'vue-router';
|
||||
import Home from './views/Home.vue';
|
||||
import conf from '../public/conf.yml'; // Main site configuration
|
||||
import { pageInfo as defaultPageInfo } from './utils/defaults';
|
||||
import { pageInfo as defaultPageInfo, localStorageKeys } from './utils/defaults';
|
||||
|
||||
Vue.use(Router);
|
||||
|
||||
const { sections, pageInfo, appConfig } = conf;
|
||||
let localPageInfo;
|
||||
try {
|
||||
localPageInfo = JSON.parse(localStorage[localStorageKeys.PAGE_INFO]);
|
||||
} catch (e) {
|
||||
localPageInfo = undefined;
|
||||
}
|
||||
|
||||
const router = new Router({
|
||||
routes: [
|
||||
@@ -16,7 +22,7 @@ const router = new Router({
|
||||
component: Home,
|
||||
props: {
|
||||
sections: sections || [],
|
||||
pageInfo: pageInfo || defaultPageInfo,
|
||||
pageInfo: localPageInfo || pageInfo || defaultPageInfo,
|
||||
appConfig: appConfig || {},
|
||||
},
|
||||
meta: {
|
||||
|
||||
Reference in New Issue
Block a user