fix: add another check to limit submit form custom images to 3
This commit is contained in:
parent
efda1acdc1
commit
febb83a164
2 changed files with 8 additions and 8 deletions
|
|
@ -7,9 +7,5 @@ export default async function SubmitPage() {
|
||||||
|
|
||||||
if (!session) redirect("/login");
|
if (!session) redirect("/login");
|
||||||
|
|
||||||
return (
|
return <SubmitForm />;
|
||||||
<div className="flex justify-center">
|
|
||||||
<SubmitForm />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,9 +23,13 @@ import Carousel from "../carousel";
|
||||||
export default function SubmitForm() {
|
export default function SubmitForm() {
|
||||||
const [files, setFiles] = useState<FileWithPath[]>([]);
|
const [files, setFiles] = useState<FileWithPath[]>([]);
|
||||||
|
|
||||||
const handleDrop = useCallback((acceptedFiles: FileWithPath[]) => {
|
const handleDrop = useCallback(
|
||||||
setFiles((prev) => [...prev, ...acceptedFiles]);
|
(acceptedFiles: FileWithPath[]) => {
|
||||||
}, []);
|
if (files.length >= 3) return;
|
||||||
|
setFiles((prev) => [...prev, ...acceptedFiles]);
|
||||||
|
},
|
||||||
|
[files.length]
|
||||||
|
);
|
||||||
|
|
||||||
const { getRootProps, getInputProps } = useDropzone({
|
const { getRootProps, getInputProps } = useDropzone({
|
||||||
onDrop: handleDrop,
|
onDrop: handleDrop,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue