Skip to content

Commit

Permalink
fix(ui): use silent upload for single-image upload buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
psychedelicious authored and hipsterusername committed Nov 14, 2024
1 parent 3eccce3 commit 48aa98b
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,24 @@ export const useImageUploadButton = ({ onUpload, isDisabled, allowMultiple }: Us
log.warn('Multiple files dropped but only one allowed');
return;
}
if (files.length === 0) {
// Should never happen
log.warn('No files dropped');
return;
}
const file = files[0];
assert(file !== undefined); // should never happen
const imageDTO = await uploadImage({
file,
image_category: 'user',
is_intermediate: false,
board_id: autoAddBoardId === 'none' ? undefined : autoAddBoardId,
silent: true,
}).unwrap();
if (onUpload) {
onUpload(imageDTO);
}
} else {
//
const imageDTOs = await uploadImages(
files.map((file, i) => ({
file,
Expand Down

0 comments on commit 48aa98b

Please sign in to comment.