From 3bbe6d0f4ef41013c2ada5f9830697a0407b7db0 Mon Sep 17 00:00:00 2001 From: Jack Date: Fri, 27 Aug 2021 20:12:56 +0100 Subject: [PATCH] running api call asynchronously --- src/js/test/test-logic.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/js/test/test-logic.js b/src/js/test/test-logic.js index 334339fa0..1fa5dd155 100644 --- a/src/js/test/test-logic.js +++ b/src/js/test/test-logic.js @@ -1590,15 +1590,16 @@ export async function finish(difficultyFailed = false) { if (firebase.auth().currentUser != null) { completedEvent.uid = firebase.auth().currentUser.uid; - let quoteStats = await RateQuotePopup.getQuoteStats(randomQuote); - if (quoteStats !== null) { - $(".pageTest #result #rateQuoteButton .rating").text( - quoteStats.average - ); - } else { - $(".pageTest #result #rateQuoteButton .rating").text(""); - } - $(".pageTest #result #rateQuoteButton").removeClass("hidden"); + RateQuotePopup.getQuoteStats(randomQuote).then((quoteStats) => { + if (quoteStats !== null) { + $(".pageTest #result #rateQuoteButton .rating").text( + quoteStats.average + ); + } else { + $(".pageTest #result #rateQuoteButton .rating").text(""); + } + $(".pageTest #result #rateQuoteButton").removeClass("hidden"); + }); //check local pb AccountButton.loading(true);