🔒 Add missing null checks

This commit is contained in:
Alicia Sykes 2024-04-09 20:39:48 +01:00
parent 49eb262465
commit ee735fe342
2 changed files with 6 additions and 4 deletions

View File

@ -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;

View File

@ -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) => {