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");
|
||||
|
||||
return (
|
||||
<div className="flex justify-center">
|
||||
<SubmitForm />
|
||||
</div>
|
||||
);
|
||||
return <SubmitForm />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,9 +23,13 @@ import Carousel from "../carousel";
|
|||
export default function SubmitForm() {
|
||||
const [files, setFiles] = useState<FileWithPath[]>([]);
|
||||
|
||||
const handleDrop = useCallback((acceptedFiles: FileWithPath[]) => {
|
||||
setFiles((prev) => [...prev, ...acceptedFiles]);
|
||||
}, []);
|
||||
const handleDrop = useCallback(
|
||||
(acceptedFiles: FileWithPath[]) => {
|
||||
if (files.length >= 3) return;
|
||||
setFiles((prev) => [...prev, ...acceptedFiles]);
|
||||
},
|
||||
[files.length]
|
||||
);
|
||||
|
||||
const { getRootProps, getInputProps } = useDropzone({
|
||||
onDrop: handleDrop,
|
||||
|
|
|
|||
Loading…
Reference in a new issue