You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.0 KiB
36 lines
1.0 KiB
import React, {useEffect,useState} from 'react';
|
|
import {useDispatch, useSelector} from "react-redux";
|
|
import {getPosts} from "../actions/post.actions";
|
|
import {getUserTemp} from "../actions/user.actions";
|
|
import {useParams} from "react-router-dom";
|
|
import {isEmpty} from "./Utils";
|
|
import FollowHandler from "./UserProfil/FollowHandler";
|
|
|
|
const MiniProfil = ({uid} ) => {
|
|
const [userData, setUserData] = useState(null);
|
|
|
|
useEffect(() => {
|
|
async function fetchData() {
|
|
const response = await fetch(`${process.env.REACT_APP_API_URL}api/user/${uid}`);
|
|
const data = await response.json();
|
|
setUserData(data);
|
|
}
|
|
fetchData();
|
|
}, [uid]);
|
|
|
|
if (!userData) {
|
|
return <p>Loading...</p>;
|
|
}
|
|
|
|
return (
|
|
<div className="ListReco">
|
|
<div className="UtiReco">
|
|
<img className="image" src={userData.picture}/>
|
|
<a href={`/Profil/${uid}`}>{userData.pseudo}</a>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default MiniProfil;
|