Skip to content

Commit

Permalink
Add condition to prevent unnecessary requests
Browse files Browse the repository at this point in the history
  • Loading branch information
babico committed Jul 27, 2023
1 parent 5970de7 commit bc57aae
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions wakapidisplay@babico/files/wakapidisplay@babico/applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ WakapiDisplay.prototype = {
// set logo color
this.set_applet_icon_name(`wakapi-${this.logoColor}`);

// apply new settings
this.startUp(false);
// apply new settings if apiKey setted correctly
let len = this.apiKey.length;
if (len == 36)
this.startUp(false);
},

startUp: function (setupLoop) {
Expand All @@ -90,7 +92,7 @@ WakapiDisplay.prototype = {
// show the time from the status bar endpoint
this.requestStatusBar().then(
(data) => {
if (data.data === undefined)
if (data.data === undefined)
throw new Error(`No data returned from request, err: ${data}`);

this.set_applet_label(' ' + data.data.grand_total.digital);
Expand Down

0 comments on commit bc57aae

Please sign in to comment.