diff --git a/Site Web/client/src/components/Post/Post.js b/Site Web/client/src/components/Post/Post.js index 29b8632a..3f1463e7 100644 --- a/Site Web/client/src/components/Post/Post.js +++ b/Site Web/client/src/components/Post/Post.js @@ -10,7 +10,9 @@ const LinkPreview = ({ link }) => { const [preview, setPreview] = useState({ image: '', title: '', description: '' }); useEffect(() => { - const key = '9f24d981b6f0ddfce993ce4a20d58867'; + //const key = '9f24d981b6f0ddfce993ce4a20d58867'; + const key = '2865b6b9d9571dc00bf940fad5728248'; + const fullLink = `http://api.linkpreview.net/?key=${key}&q=${link}`; axios @@ -19,17 +21,19 @@ const LinkPreview = ({ link }) => { .catch((err) => console.error(err)); }, [link]); - return ( -
- - {preview.title} - - {/* - {link} - -

{preview.description}

*/} -
- ); + if(preview.image === "") { + return (
{link}
); + } + else { + return ( +
+ + {preview.title}/ + +

{preview.description}

+
+ ); + } }; //e.preventDefaul(); pour ne pas recharcher la page @@ -75,10 +79,9 @@ const Post = ( { post } ) => {
- {/* */} +

{post.message}

-