From 6b697d8a3fd8693e73c967c26ba96a6b4f9df719 Mon Sep 17 00:00:00 2001 From: Simon Malesys <simon.malesys@pasteur.fr> Date: Fri, 28 Mar 2025 11:48:40 +0100 Subject: [PATCH] Always get the stats first --- src/client/components/TheHomePage.vue | 7 ++++--- src/client/store.ts | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/client/components/TheHomePage.vue b/src/client/components/TheHomePage.vue index 8f1d92d..11f92be 100644 --- a/src/client/components/TheHomePage.vue +++ b/src/client/components/TheHomePage.vue @@ -145,9 +145,10 @@ const versionDate = computed(() => { return store.antibodiesVersionDate }) * give the user a preview of what to expect after a search. */ onMounted((): void => { - store.getStatistics() - store.fetchAntibodies(store.request.fetchParams()) - store.countAntibodies(store.request.countParams()) + store.getStatistics().then(() => { + store.fetchAntibodies(store.request.fetchParams()) + store.countAntibodies(store.request.countParams()) + }) }) </script> diff --git a/src/client/store.ts b/src/client/store.ts index 402666a..e003d5e 100644 --- a/src/client/store.ts +++ b/src/client/store.ts @@ -170,8 +170,8 @@ export const useStore = defineStore('store', { * Get the database statistics from the server and stores it in the * corresponding variable in the store. */ - getStatistics(): void { - api.getStatistics().then(response => { + getStatistics(): Promise<void> { + return api.getStatistics().then(response => { this.statistics = Object.freeze(response.data) }).catch((err: AxiosError) => { alert(err.message) -- GitLab