Skip to content

Commit

Permalink
ensure that JS-loaded config has the minimum required fields as defin…
Browse files Browse the repository at this point in the history
…ed by the default in JS
  • Loading branch information
jsheunis committed Jan 17, 2024
1 parent d60437f commit 531cfad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions datalad_catalog/catalog/assets/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ var datacat = new Vue({
})
.then((responseJson) => {
obj = responseJson;
// first ensure that the config has all required fields;
// if some are missing, fill them in from default_config
for (const [key, value] of Object.entries(default_config)) {
if (!obj.hasOwnProperty(key) ) {
obj[key] = value;
}
}
// set social links
this.social_links = obj.social_links
// set dataset options
Expand Down

0 comments on commit 531cfad

Please # to comment.