refactor: we don't need to pass the endpoint, the sdk handles it
This commit is contained in:
parent
482fd966cc
commit
2e918e7802
|
@ -159,9 +159,7 @@ const UploadFileForm = () => {
|
||||||
state,
|
state,
|
||||||
removeFile,
|
removeFile,
|
||||||
cancelAll,
|
cancelAll,
|
||||||
} = useUppy({
|
} = useUppy();
|
||||||
endpoint: import.meta.env.VITE_PUBLIC_TUS_ENDPOINT,
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log({ state, files: getFiles() });
|
console.log({ state, files: getFiles() });
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,7 @@ const LISTENING_EVENTS = [
|
||||||
"files-added"
|
"files-added"
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
export function useUppy({
|
export function useUppy() {
|
||||||
endpoint
|
|
||||||
}: {
|
|
||||||
endpoint: string
|
|
||||||
}) {
|
|
||||||
const sdk = useSdk()
|
const sdk = useSdk()
|
||||||
|
|
||||||
const [uploadLimit, setUploadLimit] = useState<number>(0)
|
const [uploadLimit, setUploadLimit] = useState<number>(0)
|
||||||
|
@ -161,7 +157,7 @@ export function useUppy({
|
||||||
})
|
})
|
||||||
|
|
||||||
if (useTus) {
|
if (useTus) {
|
||||||
uppy.use(Tus, { endpoint: endpoint, limit: 6, parallelUploads: 10 })
|
uppy.use(Tus, { limit: 6, parallelUploads: 10 })
|
||||||
uppy.addPreProcessor(tusPreprocessor)
|
uppy.addPreProcessor(tusPreprocessor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +207,7 @@ export function useUppy({
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
setState("idle")
|
setState("idle")
|
||||||
}, [targetRef, endpoint, uploadLimit])
|
}, [targetRef, uploadLimit])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return () => {
|
return () => {
|
||||||
|
|
Loading…
Reference in New Issue