Rev 2420 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
import React from "react";
import { useEffect, useState } from "react";
import {axios} from "../../../utils";
const PeopleViewedHelper = (props) => {
// props destructuring
const { profileId } = props;
// states
const [peopleViewedProfile, setPeopleViewedProfile] = useState([]);
useEffect(() => {
axios
.get(`/helpers/people-viewed-profile/${profileId}`)
.then((response) => {
const resData = response.data;
(resData);
if (resData.success) {
setPeopleViewedProfile(resData.data);
} else {
// alert error
}
});
}, []);
return (
<React.Fragment>
<div
className="suggestions full-width"
id="suggestions-list-people-viewed-profile"
>
<div className="sd-title">
<h3>Quién ha visto este perfil</h3>
</div>
{/* <!--sd-title end--> */}
<div className="suggestions-list">
{peopleViewedProfile.length > 0 ? (
peopleViewedProfile.map(({ id, name, image, profile }) => (
<div className="suggestion-usd" key={id}>
<img
style={{ width: "50px", height: "auto" }}
src={image}
alt="user-img"
/>
<div className="sgt-text">
<a href={profile} target="_blank">
<h4>{name}</h4>
</a>
</div>
<span>
</span>
</div>
))
) : (
<div className="view-more">Sin visitas</div>
)}
</div>
{/* <!--suggestions-list end--> */}
</div>
{/* <!--suggestions end--> */}
</React.Fragment>
);
};
export default PeopleViewedHelper;