Skip to content

Commit

Permalink
fix: Ensure new settings are set on existing installations
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed May 9, 2024
1 parent 234cbc8 commit 7cc0e87
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ $PI.onConnected((jsn) => {
const { payload, context } = actionInfo;
const { settings } = payload;

if (Object.keys(settings).length !== 0) {
Utils.setFormValue(settings, form);
} else {
Utils.setFormValue(DefaultSettings, form);
}
Utils.setFormValue({ ...DefaultSettings, ...settings }, form);

form.addEventListener(
"input",
Expand Down
2 changes: 1 addition & 1 deletion src/com.gabe565.nightscout.sdPlugin/js/Nightscout.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Nightscout {
}

async setSettings(settings) {
this.settings = settings;
this.settings = { ...DefaultSettings, ...settings };
if (this.settings.nightscoutUrl) {
if (this.settings.token) {
try {
Expand Down

0 comments on commit 7cc0e87

Please sign in to comment.