import { Link, useParams } from "react-router-dom"; import { useState, useEffect } from "react"; import userApi from "../../apis/user.api"; import catchErrors from "../../context/catchError"; const userprofile = localStorage.getItem("user"); const INIT_PROFILE = { img:"", }; const Profile = () => { const [profile, setProfile] = useState(INIT_PROFILE); const [error,setError]= useState(""); async function getProfile(userID) { try { const data = await userApi.getUser(userID); console.log(data) setProfile(data.img) } catch (error) { catchErrors(error, setError); } } console.log(profile) useEffect(() => { getProfile(userprofile); }, [userprofile]); const { id } = useParams(); return (
<>
); }; export default Profile;