Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

πŸ”’ Add missing null checks

Alicia Sykesee735fe34246
diff --git a/src/store.js b/src/store.js
index 5a0d3b80..c137ceaa 100644
--- a/src/store.js
+++ b/src/store.js
@@ -350,9 +350,9 @@ const store = new Vuex.Store({
}
axios.get(subConfigPath).then((response) => {
- const configContent = yaml.load(response.data);
+ const configContent = yaml.load(response.data) || {};
// Certain values must be inherited from root config
- const theme = configContent?.appConfig?.theme || rootConfig?.appConfig?.theme;
+ const theme = configContent?.appConfig?.theme || rootConfig.appConfig?.theme || 'default';
configContent.appConfig = rootConfig.appConfig;
configContent.pages = rootConfig.pages;
configContent.appConfig.theme = theme;
diff --git a/src/utils/HeaderAuth.js b/src/utils/HeaderAuth.js
index 5dc52367..69f417e6 100644
--- a/src/utils/HeaderAuth.js
+++ b/src/utils/HeaderAuth.js
@@ -27,8 +27,10 @@ class HeaderAuth {
return new Promise((resolve, reject) => {
const baseUrl = process.env.VUE_APP_DOMAIN || window.location.origin;
axios.get(`${baseUrl}${serviceEndpoints.getUser}`).then((response) => {
- if (!response.data || response.data.errorMsg) {
- reject(response.data.errorMsg || 'Error');
+ if (!response.data) {
+ reject(Error('Error, expected data nout returned'));
+ } else if (response.data.errorMsg) {
+ reject(response.data.errorMsg);
} else {
try {
this.users.forEach((user) => {