diff --git a/package.json b/package.json index 6a2719c..717840a 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "dev": "NODE_ENV=development node server", "build": "npm-run-all build:schema build:next", "build:next": "next build", - "build:schema": "prisma generate --schema=prisma/schema.shared.prisma", + "build:schema": "prisma generate --schema=prisma/schema.sqlite.prisma", "start": "node server", "lint": "next lint", "ts-node": "./node_modules/.bin/ts-node --compiler-options \"{\\\"module\\\":\\\"commonjs\\\"}\" --transpile-only", diff --git a/src/components/pages/Upload.tsx b/src/components/pages/Upload.tsx index e9bdcb5..cd4db20 100644 --- a/src/components/pages/Upload.tsx +++ b/src/components/pages/Upload.tsx @@ -3,13 +3,13 @@ import { Typography, Button, CardActionArea, Paper, Box } from '@material-ui/cor import { Upload as UploadIcon } from '@material-ui/icons'; import Dropzone from 'react-dropzone'; -import useFetch from 'hooks/useFetch'; import Backdrop from 'components/Backdrop'; import Alert from 'components/Alert'; import { useStoreSelector } from 'lib/redux/store'; import CenteredBox from 'components/CenteredBox'; +import copy from 'copy-to-clipboard'; -export default function Manage({ route }) { +export default function Upload({ route }) { const user = useStoreSelector(state => state.user); const [file, setFile] = useState(null); @@ -34,7 +34,8 @@ export default function Manage({ route }) { if (res.ok && json.error === undefined) { setOpen(true); setSeverity('success'); - setMessage(`File uploaded! ${json.url}`); + setMessage(`Copied to clipboard! ${json.url}`); + copy(json.url); } else { setOpen(true); setSeverity('error'); diff --git a/src/pages/api/upload.ts b/src/pages/api/upload.ts index 49c1c0e..789388e 100644 --- a/src/pages/api/upload.ts +++ b/src/pages/api/upload.ts @@ -22,7 +22,6 @@ async function handler(req: NextApiReq, res: NextApiRes) { }); if (!user) return res.forbid('authorization incorect'); if (!req.file) return res.error('no file'); - console.log(req.file); const ext = req.file.originalname.split('.').pop();