エラーハンドリング
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 }), | ||||
| 				}; | ||||
| 
 | ||||
| 				try { | ||||
| 					const { readAndCompressImage } = await import('browser-image-resizer'); | ||||
| 					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(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue