From ff4f3194055df317aba588fa17898d3add2ad8aa Mon Sep 17 00:00:00 2001 From: Darius BERTRAND Date: Tue, 17 Jan 2023 14:51:10 +0100 Subject: [PATCH 1/2] avancement --- .../Configurations/ConfigurationDuProfil.js | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/Site Web/client/src/components/Configurations/ConfigurationDuProfil.js b/Site Web/client/src/components/Configurations/ConfigurationDuProfil.js index b79b8ac7..7f815912 100644 --- a/Site Web/client/src/components/Configurations/ConfigurationDuProfil.js +++ b/Site Web/client/src/components/Configurations/ConfigurationDuProfil.js @@ -13,8 +13,8 @@ const ConfigurationDuProfil = ()=>{ const userData = useSelector((state) => state.user.user); const [pseudo, setPseudo] = useState(userData.pseudo); - const[userPicture, setUserPicture] = useState(userData.picture) - const [tmpImage, setTmpImage] =useState('') + const[userPicture, setUserPicture] = useState(userData.picture); + const [tmpImage, setTmpImage] =useState(PLUS); const [displayAdd, setDisplayAdd] = useState(false); const dispatch = useDispatch(); @@ -23,11 +23,23 @@ const ConfigurationDuProfil = ()=>{ setDisplayAdd(false); } const handleLoadFile=(e)=>{ - var image = document.getElementById("output"); - image.src = URL.createObjectURL(e.target.files[0]); - setTmpImage(image.src); + const file=e.target.files[0]; + const reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = () => { + setTmpImage({ + data: reader.result, + contentType: file.type, + }); }; + }; + + + const handleTPM =()=> { + console.log("test"); + console.log(tmpImage); + } const handleUpdate = async (e) => { console.log(userPicture) e.preventDefault(); @@ -124,13 +136,13 @@ const ConfigurationDuProfil = ()=>{ Changer - {/* onChange={(e)=> setTmpImage(e.target.files[0].name)} */} - + {/*onChange={handleLoadFile} onChange={(e)=> setTmpImage(e.target.files[0].name)} */} +
- +
From 78340277f23ba45b3210e10878030c97370120ce Mon Sep 17 00:00:00 2001 From: Darius BERTRAND Date: Tue, 17 Jan 2023 16:22:22 +0100 Subject: [PATCH 2/2] =?UTF-8?q?correction=20bugs=20profil=20=C2=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Site Web/client/src/pages/Profil.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Site Web/client/src/pages/Profil.js b/Site Web/client/src/pages/Profil.js index ac383372..4d4632f1 100644 --- a/Site Web/client/src/pages/Profil.js +++ b/Site Web/client/src/pages/Profil.js @@ -13,6 +13,11 @@ import MiniProfil from "../components/MiniProfil"; const Profil = () => { const { uid } = useParams(); const [userData, setUserData] = useState(null); + const [followingPopup, setFollowingPopup] = useState(false); + const [followerPopup, setFollowerPopup] = useState(false); + const [dossierPersonnels,setdossierPersonnels ] = useState(false); + const [postPersonnels,setpostPersonnels ] = useState(true); + const [postLikes,setpostLikes ] = useState(false) useEffect(() => { async function fetchData() { @@ -24,12 +29,6 @@ const Profil = () => { }, [uid]); - const [followingPopup, setFollowingPopup] = useState(false); - const [followerPopup, setFollowerPopup] = useState(false); - const [dossierPersonnels,setdossierPersonnels ] = useState(false); - const [postPersonnels,setpostPersonnels ] = useState(true); - const [postLikes,setpostLikes ] = useState(false) - const handleModals = (e) => { if (e.target.id === "DossierPersonnels") { setdossierPersonnels(true); @@ -217,13 +216,13 @@ const Profil = () => {