fix review comments

This commit is contained in:
vivganes 2023-04-13 19:38:00 +05:30
parent 72ba041c89
commit 910686eab0
1 changed files with 3 additions and 4 deletions

View File

@ -112,7 +112,7 @@ export function NoteCreator() {
}
}
async function uploadFile(file: File) {
async function uploadFile(file: File | Blob) {
setUploadInProgress(true);
try {
if (file) {
@ -122,12 +122,12 @@ export function NoteCreator() {
} else if (rx?.error) {
dispatch(setError(rx.error));
}
setUploadInProgress(false);
}
} catch (error: unknown) {
if (error instanceof Error) {
dispatch(setError(error?.message));
}
} finally {
setUploadInProgress(false);
}
}
@ -237,8 +237,7 @@ export function NoteCreator() {
const item = items[0];
const blob = item.getAsFile();
if (blob) {
const file = new File([blob], "filename.jpg", { type: "image/jpeg", lastModified: new Date().getTime() });
uploadFile(file);
uploadFile(blob);
}
}
};