From 5d088a0fac1dd78795c8aac7170960466ab5bdd5 Mon Sep 17 00:00:00 2001 From: Spythere Date: Thu, 12 Mar 2026 22:03:24 +0100 Subject: [PATCH] fix(api): update tick awaiting for all static data to refresh before requesting active data --- src/store/apiStore.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/store/apiStore.ts b/src/store/apiStore.ts index 0404bdd..a93247b 100644 --- a/src/store/apiStore.ts +++ b/src/store/apiStore.ts @@ -7,6 +7,7 @@ import axios, { AxiosInstance } from 'axios'; export const useApiStore = defineStore('apiStore', { state: () => ({ dataStatuses: { + allData: Status.Data.Loading, connection: Status.Data.Loading, sceneries: Status.Data.Loading, vehicles: Status.Data.Loading, @@ -55,19 +56,19 @@ export const useApiStore = defineStore('apiStore', { window.requestAnimationFrame(this.updateTick); }, - updateTick(t: number) { + async updateTick(t: number) { // Static data refresh if (t >= this.nextDataCheckTime) { - this.fetchDonatorsData(); - this.fetchVehiclesInfo(); - this.fetchStationsGeneralInfo(); + await this.fetchStationsGeneralInfo(); + await this.fetchVehiclesInfo(); + await this.fetchDonatorsData(); this.nextDataCheckTime = t + 3600000; } // Active data fefresh if (t >= this.nextUpdateTime) { - this.fetchActiveData(); + await this.fetchActiveData(); this.nextUpdateTime = t + 31000; }