From e38f3cbd373c5dc1365715e4479b127ae92931b8 Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Fri, 7 Feb 2025 13:29:53 +0100 Subject: [PATCH] fix: download all query rows before csv export --- src/stores/admin/club/queryBuilder.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/stores/admin/club/queryBuilder.ts b/src/stores/admin/club/queryBuilder.ts index 159a423..25a87e2 100644 --- a/src/stores/admin/club/queryBuilder.ts +++ b/src/stores/admin/club/queryBuilder.ts @@ -30,7 +30,7 @@ export const useQueryBuilderStore = defineStore("queryBuilder", { this.loading = "failed"; }); }, - sendQuery(offset = 0, count = 25, query?: DynamicQueryStructure | string) { + async sendQuery(offset = 0, count = 25, query?: DynamicQueryStructure | string) { this.queryError = ""; if (offset == 0) { this.data = []; @@ -40,7 +40,7 @@ export const useQueryBuilderStore = defineStore("queryBuilder", { if (queryToSend == undefined || queryToSend == "" || (typeof queryToSend != "string" && queryToSend.table == "")) return; this.loadingData = "loading"; - http + await http .post(`/admin/querybuilder/query?offset=${offset}&count=${count}`, { query: queryToSend, }) @@ -65,7 +65,8 @@ export const useQueryBuilderStore = defineStore("queryBuilder", { this.queryError = ""; this.loadingData = "fetched"; }, - exportData() { + async exportData() { + await this.sendQuery(0, this.totalLength); if (this.data.length == 0) return; const csvString = [Object.keys(this.data[0]), ...this.data.map((d) => Object.values(d))] .map((e) => e.join(";"))