Skip to content

Instantly share code, notes, and snippets.

@sergeyt
Created August 5, 2021 18:27
Show Gist options
  • Save sergeyt/0cac81b09e6369be780c89bb7db49973 to your computer and use it in GitHub Desktop.
Save sergeyt/0cac81b09e6369be780c89bb7db49973 to your computer and use it in GitHub Desktop.
multidisk uploader
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:&nbsp;</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