エラーハンドリング
This commit is contained in:
parent
fdb17e08b9
commit
7102e43e1e
1 changed files with 7 additions and 3 deletions
|
@ -62,9 +62,13 @@ export function uploadFile(
|
||||||
...(changeType ? {} : { mimeType: file.type }),
|
...(changeType ? {} : { mimeType: file.type }),
|
||||||
};
|
};
|
||||||
|
|
||||||
const { readAndCompressImage } = await import('browser-image-resizer');
|
try {
|
||||||
resizedImage = await readAndCompressImage(file, config);
|
const { readAndCompressImage } = await import('browser-image-resizer');
|
||||||
ctx.name = changeType ? `${ctx.name}.${mimeTypeMap[compressTypeMap[file.type].mimeType]}` : ctx.name;
|
resizedImage = await readAndCompressImage(file, config);
|
||||||
|
ctx.name = changeType ? `${ctx.name}.${mimeTypeMap[compressTypeMap[file.type].mimeType]}` : ctx.name;
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Failed to resize image', e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = new FormData();
|
const data = new FormData();
|
||||||
|
|
Loading…
Reference in a new issue