Skip to content

Commit

Permalink
fix: filter files by signer uuid
Browse files Browse the repository at this point in the history
When already loaded all files, filter existing files using the filter
argument when this exists

Signed-off-by: Vitor Mattos <[email protected]>
  • Loading branch information
vitormattos authored and backportbot-libresign[bot] committed Nov 15, 2024
1 parent 0d8be92 commit 843f352
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/store/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 843f352

Please sign in to comment.