From 2e918e780229447837c019b09efc474a71af942b Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Tue, 19 Mar 2024 07:18:31 -0400 Subject: [PATCH] refactor: we don't need to pass the endpoint, the sdk handles it --- app/components/general-layout.tsx | 4 +--- app/components/lib/uppy.ts | 10 +++------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/app/components/general-layout.tsx b/app/components/general-layout.tsx index be666f0..01025de 100644 --- a/app/components/general-layout.tsx +++ b/app/components/general-layout.tsx @@ -159,9 +159,7 @@ const UploadFileForm = () => { state, removeFile, cancelAll, - } = useUppy({ - endpoint: import.meta.env.VITE_PUBLIC_TUS_ENDPOINT, - }); + } = useUppy(); console.log({ state, files: getFiles() }); diff --git a/app/components/lib/uppy.ts b/app/components/lib/uppy.ts index bda8c9a..5fb54bc 100644 --- a/app/components/lib/uppy.ts +++ b/app/components/lib/uppy.ts @@ -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(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 () => {