Skip to content

Commit

Permalink
revert to vanilla uploadthing implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
jthrilly committed Oct 11, 2023
1 parent f5fa55b commit 328036b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 91 deletions.
14 changes: 3 additions & 11 deletions app/(dashboard)/dashboard/_components/ProtocolUploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { useDropzone } from 'react-dropzone';
import { ChevronDown, ChevronUp } from 'lucide-react';
import type { FileWithPath } from 'react-dropzone';
import { generateReactHelpers } from '~/utils/uploadthing/useUploadThing';
import { generateReactHelpers } from '@uploadthing/react/hooks';
import { useState, useCallback } from 'react';

import { importProtocol } from '../_actions/importProtocol';
Expand Down Expand Up @@ -102,9 +102,8 @@ export default function ProtocolUploader({
});
};

const { startUpload } = useUploadThing({
endpoint: 'protocolUploader',
onClientUploadComplete: handleUploadComplete,
const { startUpload } = useUploadThing('protocolUploader', {
onClientUploadComplete: (res) => void handleUploadComplete(res),
onUploadError: (error) => {
setOpen(true);
setDialogContent({
Expand All @@ -123,13 +122,6 @@ export default function ProtocolUploader({
error: '',
});
},
onUploadProgress: (file, progress) => {
// eslint-disable-next-line no-console
console.log(
'🚀 ~ file: ProtocolUploader.tsx:102 ~ ProtocolUploader ~ file>:progress',
`${file}>${progress}`,
);
},
});

const onDrop = useCallback(
Expand Down
80 changes: 0 additions & 80 deletions utils/uploadthing/useUploadThing.ts

This file was deleted.

0 comments on commit 328036b

Please sign in to comment.