mirror of
https://github.com/Lissy93/dashy.git
synced 2025-07-31 01:24:42 +02:00
⚡ Adds safeguards to prevent error when conf.yml is empty
This commit is contained in:
parent
5b6663dab8
commit
424cef1f81
@ -23,7 +23,10 @@ export default class ConfigAccumulator {
|
|||||||
|
|
||||||
/* App Config */
|
/* App Config */
|
||||||
appConfig() {
|
appConfig() {
|
||||||
const appConfigFile = this.conf.appConfig || {};
|
let appConfigFile = {};
|
||||||
|
if (this.conf) {
|
||||||
|
appConfigFile = this.conf.appConfig || {};
|
||||||
|
}
|
||||||
let usersAppConfig = defaultAppConfig;
|
let usersAppConfig = defaultAppConfig;
|
||||||
if (localStorage[localStorageKeys.APP_CONFIG]) {
|
if (localStorage[localStorageKeys.APP_CONFIG]) {
|
||||||
usersAppConfig = JSON.parse(localStorage[localStorageKeys.APP_CONFIG]);
|
usersAppConfig = JSON.parse(localStorage[localStorageKeys.APP_CONFIG]);
|
||||||
@ -48,8 +51,11 @@ export default class ConfigAccumulator {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
localPageInfo = {};
|
localPageInfo = {};
|
||||||
}
|
}
|
||||||
const filePageInfo = this.conf.pageInfo || {};
|
let filePageInfo = {};
|
||||||
const pi = this.conf.pageInfo || defaults; // The page info object to return
|
if (this.conf) {
|
||||||
|
filePageInfo = this.conf.pageInfo || {};
|
||||||
|
}
|
||||||
|
const pi = filePageInfo || defaults; // The page info object to return
|
||||||
pi.title = localPageInfo.title || filePageInfo.title || defaults.title;
|
pi.title = localPageInfo.title || filePageInfo.title || defaults.title;
|
||||||
pi.logo = localPageInfo.logo || filePageInfo.logo || defaults.logo;
|
pi.logo = localPageInfo.logo || filePageInfo.logo || defaults.logo;
|
||||||
pi.description = localPageInfo.description || filePageInfo.description || defaults.description;
|
pi.description = localPageInfo.description || filePageInfo.description || defaults.description;
|
||||||
@ -71,7 +77,9 @@ export default class ConfigAccumulator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If the function hasn't yet returned, then return the config file sections
|
// If the function hasn't yet returned, then return the config file sections
|
||||||
return this.conf.sections;
|
let sectionsFile = [];
|
||||||
|
if (this.conf) sectionsFile = this.conf.sections || [];
|
||||||
|
return sectionsFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Complete config */
|
/* Complete config */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user