From 843f3522e3299c51099f33e7011d1f290cb54af2 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Fri, 15 Nov 2024 14:09:09 -0300 Subject: [PATCH] fix: filter files by signer uuid When already loaded all files, filter existing files using the filter argument when this exists Signed-off-by: Vitor Mattos --- src/store/files.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/store/files.js b/src/store/files.js index 64abc7e2bc..2eb2b93d55 100644 --- a/src/store/files.js +++ b/src/store/files.js @@ -245,7 +245,21 @@ export const useFilesStore = function(...args) { }, async getAllFiles(filter) { if (this.loading || this.loadedAll) { - return this.files + if (!filter) { + return this.files + } + return Object.fromEntries( + Object.entries(this.files).filter(([key, value]) => { + if (filter.signer_uuid) { + // return true when found signer by signer_uuid + return value.signers.filter((signer) => { + // filter signers by signer_uuid + return signer.sign_uuid === filter.signer_uuid + }).length > 0 + } + return false + }), + ) } this.loading = true const url = !this.paginationNextUrl