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); setProfile(data.img) } catch (error) { catchErrors(error, setError); } } useEffect(() => { getProfile(userprofile); }, [userprofile]); const { id } = useParams(); return (