From 1638acac7dfb7d5a07cbd908c02e6da800fcbbec Mon Sep 17 00:00:00 2001 From: Liam <67254223+RealFascinated@users.noreply.github.com> Date: Mon, 10 Oct 2022 09:17:19 +0100 Subject: [PATCH] Player values update on song finish now --- pages/index.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/pages/index.js b/pages/index.js index 05e1790..ee11f56 100644 --- a/pages/index.js +++ b/pages/index.js @@ -105,13 +105,7 @@ export default class Home extends Component { setTimeout(async () => { await this.updateData(id); - }, 10); - setTimeout(async () => { - if (!this.state.isValidSteamId) { - return; - } - await this.updateData(id); - }, 30_000); // Update the player data every 30 seconds. + }, 10); // 10ms let shouldConnectSocket = false; @@ -188,8 +182,11 @@ export default class Home extends Component { * * @param {boolean} visible Whether to show info other than the player stats */ - resetData(visible) { + async resetData(visible) { console.log("Exiting level, resetting data.") + setTimeout(async () => { + await this.updateData(id); + }, 250); this.setState({ leftHand: { averageCut: [15.00], @@ -276,7 +273,6 @@ export default class Home extends Component { this.setBeatSaver(data.status.beatmap); }, "finished": () => { - console.log("Exiting level, resetting data.") this.resetData(false); }, "softFail": () => { @@ -289,7 +285,6 @@ export default class Home extends Component { this.setState({ paused: false }); }, "menu": () => { - console.log("Exiting level, resetting data.") this.resetData(false); }, "noteCut": () => {},