use await/async

pull/509/head
sachaaaaa 6 years ago
parent 8ecf057386
commit fa6cde6cb9

@ -82,7 +82,7 @@
// FIFO: pop at the back of the array using pop() // FIFO: pop at the back of the array using pop()
this.pubKey = this.pubKeyRequests.pop(); this.pubKey = this.pubKeyRequests.pop();
}, },
showView() { async showView() {
const defaultView = this.$('.defaultView'); const defaultView = this.$('.defaultView');
const waitingForRequestView = this.$('.waitingForRequestView'); const waitingForRequestView = this.$('.waitingForRequestView');
const requestReceivedView = this.$('.requestReceivedView'); const requestReceivedView = this.$('.requestReceivedView');
@ -93,15 +93,13 @@
requestReceivedView.hide(); requestReceivedView.hide();
waitingForRequestView.hide(); waitingForRequestView.hide();
requestAcceptedView.hide(); requestAcceptedView.hide();
// eslint-disable-next-line more/no-then const pubKeys = await libloki.storage.getSecondaryDevicesFor(ourPubKey);
libloki.storage.getSecondaryDevicesFor(ourPubKey).then(pubKeys => { if (pubKeys && pubKeys.length > 0) {
if (pubKeys && pubKeys.length > 0) { this.$('#pairedPubKeys').empty();
this.$('#pairedPubKeys').empty(); pubKeys.forEach(x => {
pubKeys.forEach(x => { this.$('#pairedPubKeys').append(`<li>${x}</li>`);
this.$('#pairedPubKeys').append(`<li>${x}</li>`); });
}); }
}
});
} else if (this.accepted) { } else if (this.accepted) {
defaultView.hide(); defaultView.hide();
requestReceivedView.hide(); requestReceivedView.hide();

Loading…
Cancel
Save