From fa6cde6cb959396ba5c0c99d0af47267965b8888 Mon Sep 17 00:00:00 2001 From: sachaaaaa Date: Tue, 17 Sep 2019 12:13:15 +1000 Subject: [PATCH] use await/async --- js/views/device_pairing_dialog_view.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/js/views/device_pairing_dialog_view.js b/js/views/device_pairing_dialog_view.js index 8406ce8e4..d4201cf7c 100644 --- a/js/views/device_pairing_dialog_view.js +++ b/js/views/device_pairing_dialog_view.js @@ -82,7 +82,7 @@ // FIFO: pop at the back of the array using pop() this.pubKey = this.pubKeyRequests.pop(); }, - showView() { + async showView() { const defaultView = this.$('.defaultView'); const waitingForRequestView = this.$('.waitingForRequestView'); const requestReceivedView = this.$('.requestReceivedView'); @@ -93,15 +93,13 @@ requestReceivedView.hide(); waitingForRequestView.hide(); requestAcceptedView.hide(); - // eslint-disable-next-line more/no-then - libloki.storage.getSecondaryDevicesFor(ourPubKey).then(pubKeys => { - if (pubKeys && pubKeys.length > 0) { - this.$('#pairedPubKeys').empty(); - pubKeys.forEach(x => { - this.$('#pairedPubKeys').append(`
  • ${x}
  • `); - }); - } - }); + const pubKeys = await libloki.storage.getSecondaryDevicesFor(ourPubKey); + if (pubKeys && pubKeys.length > 0) { + this.$('#pairedPubKeys').empty(); + pubKeys.forEach(x => { + this.$('#pairedPubKeys').append(`
  • ${x}
  • `); + }); + } } else if (this.accepted) { defaultView.hide(); requestReceivedView.hide();