Skip to content

Commit

Permalink
Improved: used for loop instead of promise for sync api calls (#616)
Browse files Browse the repository at this point in the history
  • Loading branch information
amansinghbais committed Jan 23, 2025
1 parent c22d9b5 commit 56780d6
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/components/DownloadClosedCountModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ async function fetchBulkCycleCountItems() {
}
if(!counts.length) return [];
let countItems = [] as any;
let countItems = [] as any, count = {} as any;
const responses = await Promise.allSettled(counts.map(async (count: any) => {
for(count of counts) {
let items = [] as any, resp, index = 0;
try {
do {
Expand All @@ -237,12 +237,9 @@ async function fetchBulkCycleCountItems() {
logger.error(err)
}
return items
}))
countItems = countItems.concat(items);
}
responses.map((response: any) => {
if(response.status === "fulfilled") countItems = countItems.concat(response.value);
})
return countItems
}
Expand Down

0 comments on commit 56780d6

Please sign in to comment.