Skip to content

Commit

Permalink
fix(task): set default cover after updating files (#144)
Browse files Browse the repository at this point in the history
  • Loading branch information
hudy9x authored Mar 18, 2024
1 parent a059e18 commit 78967de
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions packages/ui-app/app/_components/FileKits/useFileUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,18 @@ export default function useFileUpload() {
updateTaskData({
id: taskId,
fileIds
})

}).then(() => {

// set default cover image
for (let i = 0; i < fileItems.length; i++) {
const file = fileItems[i];
if (isImage(file.mimeType)) {
setDefaultCover(file.url)
break
}

}
})

return fileItems
}
Expand Down Expand Up @@ -226,14 +235,6 @@ export default function useFileUpload() {

setUploading(false)

for (let i = 0; i < result.length; i++) {
const file = result[i];
if (isImage(file.mimeType)) {
setDefaultCover(file.url)
break
}

}
})
}

Expand Down

0 comments on commit 78967de

Please sign in to comment.