import userApi from "../../apis/user.api"; import { useEffect, useState } from "react"; import catchErrors from "../../context/catchError"; const userprofile = localStorage.getItem("user"); const INIT_PROFILE = { name: "", email: "a", id: "", phone: "", }; const Info = () => { const [profile, setProfile] = useState(INIT_PROFILE); const [error, setError]= useState(""); async function getProfile(userID) { try { const data = await userApi.getUser(userID); setProfile(data); } catch (error) { catchErrors(error, setError); } } useEffect(() => { getProfile(userprofile); }, [userprofile]); return (