Skip to content

Commit

Permalink
fix(useUpload): fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nemo-shen committed Mar 2, 2024
1 parent 3a6b16e commit 806fed9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/core/useUpload/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe('useUpload', () => {
'file1',
])

const { files: files2, append: append2 } = useUpload({
const { append: append2 } = useUpload({
url: '#',
accept: '.png',
})
Expand All @@ -137,7 +137,7 @@ describe('useUpload', () => {
})

test('max-count', async () => {
const { files, append } = useUpload({ url: '#', maxCount: 1 })
const { append } = useUpload({ url: '#', maxCount: 1 })
expect(
append([new File([], 'file1.txt'), new File([], 'file2.txt')])
).rejects.toThrow('Exceed the maximum number of files.')
Expand Down
2 changes: 1 addition & 1 deletion packages/core/useUpload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const useUpload = (options: UseUploadOptions): UseUploadReturn => {
uploadIndexes = [index]
}
files.value.forEach((file: UseUploadFile, fileIndex) => {
if (!uploadIndexes.includes(index)) return
if (!uploadIndexes.includes(fileIndex)) return
uploadFile({ url }, file.file).then((_result) => {
files.value[fileIndex].status = 'success'
})
Expand Down

0 comments on commit 806fed9

Please sign in to comment.