diff --git a/Site Web/client/src/components/Configurations/ConfigurationDuProfil.js b/Site Web/client/src/components/Configurations/ConfigurationDuProfil.js index 564c8173..e95586f0 100644 --- a/Site Web/client/src/components/Configurations/ConfigurationDuProfil.js +++ b/Site Web/client/src/components/Configurations/ConfigurationDuProfil.js @@ -2,7 +2,6 @@ import React, { useState } from 'react'; import { useSelector } from 'react-redux'; import PP from "../../assets/img/unknown.png"; import { NavLink } from "react-router-dom"; -import { useSelector } from 'react-redux'; const ConfigurationDuProfil = ()=>{ diff --git a/Site Web/client/src/components/Post/Post.js b/Site Web/client/src/components/Post/Post.js index dbe13a19..296a3002 100644 --- a/Site Web/client/src/components/Post/Post.js +++ b/Site Web/client/src/components/Post/Post.js @@ -6,15 +6,38 @@ import { dateParser, isEmpty } from '../Utils'; import ButtonLike from './ButtonLike'; +const LinkPreview = ({ link }) => { + const [preview, setPreview] = useState({ image: '', title: '', description: '' }); + + useEffect(() => { + const key = '9f24d981b6f0ddfce993ce4a20d58867'; + const fullLink = `http://api.linkpreview.net/?key=${key}&q=${link}`; + + axios + .get(fullLink) + .then((res) => setPreview(res.data)) + .catch((err) => console.error(err)); + }, [link]); + + return ( +
+ ); +}; + //e.preventDefaul(); pour ne pas recharcher la page const Post = ( { post } ) => { const [isLoading, setIsLoading] = useState(true); const usersData = useSelector((state) => state.users.users); const userData = useSelector((state) => state.user.user); - - - useEffect(() => { !isEmpty(usersData[0]) && setIsLoading(false) }) @@ -50,11 +73,9 @@ const Post = ( { post } ) => {{post.message}