Created
August 5, 2021 18:27
-
-
Save sergeyt/0cac81b09e6369be780c89bb7db49973 to your computer and use it in GitHub Desktop.
multidisk uploader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { mutate } from "swr"; | |
import { Widget } from "@uploadcare/react-widget"; | |
import { Drive } from "../types"; | |
export default function Uploader({ drive }: { drive: Drive }) { | |
if (drive.provider === "uploadcare") { | |
return ( | |
<> | |
<label>Upload a file: </label> | |
<Widget | |
publicKey={drive.options.publicKey} | |
onChange={() => { | |
mutate(`/drive/${drive.id}`); | |
}} | |
/> | |
</> | |
); | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment