From bc57aae9bdefe7b021eb92d2f22e521702a09204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=BCsl=C3=BCm=20Bar=C4=B1=C5=9F=20Korkmazer?= Date: Thu, 27 Jul 2023 17:01:48 +0300 Subject: [PATCH] Add condition to prevent unnecessary requests --- wakapidisplay@babico/files/wakapidisplay@babico/applet.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wakapidisplay@babico/files/wakapidisplay@babico/applet.js b/wakapidisplay@babico/files/wakapidisplay@babico/applet.js index 56048eb35e3..3c5295aaf63 100644 --- a/wakapidisplay@babico/files/wakapidisplay@babico/applet.js +++ b/wakapidisplay@babico/files/wakapidisplay@babico/applet.js @@ -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) { @@ -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);