diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index db5d9f8b710027f3a25a8b5b3feb1e233f78e061..a58faaefc2c97d7e4dd72bd04206455bcf253b29 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -31,9 +31,9 @@ return <> <FontAwesomeIcon className="text-[24px]" icon={faCompass} /> </Link> {/* ADD PICS */} - <a href="/addpost"> + <Link to="/addpost"> <FontAwesomeIcon className="text-[24px]" icon={faSquarePlus} /> - </a> + </Link> {/* PROFIL */} <Link to="/profile"> <FontAwesomeIcon className="text-[24px]" icon={faCircleUser} /> diff --git a/src/views/AddPostView.tsx b/src/views/AddPostView.tsx index 328beec201c00e37cb700e388083ed08460fadb8..50f51f80f1b42e275ce82455a71f5f9080534bae 100644 --- a/src/views/AddPostView.tsx +++ b/src/views/AddPostView.tsx @@ -41,7 +41,10 @@ const AddPostView = () => { {/* MODAL */} <div className="max-w-[640px] mx-auto p-6 border rounded-xl mt-10 bg-white flex flex-col"> <p className="text-center font-bold text-2xl">{t('addpost.title')}</p> - <form className="flex flex-col gap-4 mt-6"> + <form className="flex flex-col gap-4 mt-6" onSubmit={(event)=> { + event.preventDefault(); + dispatch(addPost(selectedImg, location, caption)); //ajouter les autres éléments (accessibilityCaption, hasCommentsDisabled) ? + }}> {/* IMAGE */} <div className="flex flex-col gap-1"> <label htmlFor="image-upload" className="font-bold">{t('addpost.image')} :</label> @@ -72,11 +75,7 @@ const AddPostView = () => { className="bg-red-600 text-white font-bold h-10 rounded-md mt-2 uppercase w-full">{t('actions.cancel')}</button> </Link> {/* SUBMIT BTN */} - <button className="bg-green-700 text-white font-bold h-10 rounded-md mt-2 uppercase w-full" - onClick={(test)=> { - dispatch(addPost(selectedImg, location, caption)); //ajouter les autres éléments (accessibilityCaption, hasCommentsDisabled) ? - }} - > + <button className="bg-green-700 text-white font-bold h-10 rounded-md mt-2 uppercase w-full" type="submit"> {t('actions.send')} </button> </div>