(file: File)
| 28 | const [uploadedCount, setUploadedCount] = useState(0); |
| 29 | |
| 30 | const uploadImage = (file: File) => { |
| 31 | uploadContentImage(file, onStarted) |
| 32 | .then((url) => onFinish(UploadState.Ok, file, url)) |
| 33 | .catch(() => onFinish(UploadState.Failed, file)) |
| 34 | .finally(async () => { |
| 35 | await nextTick(); |
| 36 | |
| 37 | if (!filesRef.current.length) { |
| 38 | setUploadedCount(0); |
| 39 | setQueueCount(0); |
| 40 | return; |
| 41 | } |
| 42 | |
| 43 | setUploadedCount(uploadedCount + 1); |
| 44 | uploadImage(filesRef.current.pop()); |
| 45 | }); |
| 46 | }; |
| 47 | |
| 48 | const startUploading = () => { |
| 49 | if (!filesRef.current.length) { |
no test coverage detected