MCPcopy Create free account
hub / github.com/dailydotdev/apps / uploadImage

Function uploadImage

packages/shared/src/hooks/input/useSyncUploader.ts:30–46  ·  view source on GitHub ↗
(file: File)

Source from the content-addressed store, hash-verified

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) {

Callers 1

startUploadingFunction · 0.85

Calls 2

uploadContentImageFunction · 0.90
nextTickFunction · 0.90

Tested by

no test coverage detected