refactor: we don't need to pass the endpoint, the sdk handles it

This commit is contained in:
Derrick Hammer 2024-03-19 07:18:31 -04:00
parent 482fd966cc
commit 2e918e7802
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 4 additions and 10 deletions

View File

@ -159,9 +159,7 @@ const UploadFileForm = () => {
state,
removeFile,
cancelAll,
} = useUppy({
endpoint: import.meta.env.VITE_PUBLIC_TUS_ENDPOINT,
});
} = useUppy();
console.log({ state, files: getFiles() });

View File

@ -19,11 +19,7 @@ const LISTENING_EVENTS = [
"files-added"
] as const
export function useUppy({
endpoint
}: {
endpoint: string
}) {
export function useUppy() {
const sdk = useSdk()
const [uploadLimit, setUploadLimit] = useState<number>(0)
@ -161,7 +157,7 @@ export function useUppy({
})
if (useTus) {
uppy.use(Tus, { endpoint: endpoint, limit: 6, parallelUploads: 10 })
uppy.use(Tus, { limit: 6, parallelUploads: 10 })
uppy.addPreProcessor(tusPreprocessor)
}
@ -211,7 +207,7 @@ export function useUppy({
})
}
setState("idle")
}, [targetRef, endpoint, uploadLimit])
}, [targetRef, uploadLimit])
useEffect(() => {
return () => {