Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
Arreglado overflow en lista de deseos
Browse files Browse the repository at this point in the history
  • Loading branch information
adriandrs committed Jun 4, 2024
1 parent 6e8cc79 commit d064bab
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions client/src/pages/perfil/ListaDeseo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const StyledRating = styled(Rating)({
});

function ListaDeseo() {

const navigate = useNavigate();

const [boton1, setBoton1] = useState('lista-boton');
Expand All @@ -45,10 +45,10 @@ function ListaDeseo() {
const [sort, setSort] = useState('')
const [log, setLog] = useState(false); //<<< PARA EL INICIO DE SESION
const [login, setLogin] = useState(false);
// useEffect(()=>{
// localStorage.removeItem("favoritos")
// },[])

// useEffect(()=>{
// localStorage.removeItem("favoritos")
// },[])
async function recibido() {
const respuesta = await fetch("/api/logueado", {
method: "GET",
Expand Down Expand Up @@ -77,7 +77,7 @@ function ListaDeseo() {
const filtrar = (type) => {
settipoProducto(type);
}

const [contResumen, setContResumen] = useState([
// CONTENIDO COMENTADO. ¡¡¡USAR SOLAMENTE PARA PRUEBAS ES CASO DE NO HABER AUN CONEXION FRONT-BACK!!!
// {
Expand Down Expand Up @@ -229,18 +229,18 @@ function ListaDeseo() {
useEffect(() => {
const Prod = async () => {
if (Uid) {
try {
try {
//este fetch traera todos los favoritos del cliente,solo incluyendo servicios y productos
const response = await fetch(`/api/admin/favoritos/FavoritosbyId/${Uid}`)
const data = await response.json();
setContResumen(data)
} catch (error) {
console.error("hubo error :", error)
} catch (error) {
console.error("hubo error :", error)
}
} else {
let myArray = await JSON.parse(localStorage.getItem("favoritos")) || [];
setContResumen(myArray)
}
}else{
let myArray = await JSON.parse(localStorage.getItem("favoritos")) || [];
setContResumen(myArray)
}
}
Prod()
}, [Uid])
Expand Down Expand Up @@ -287,19 +287,19 @@ function ListaDeseo() {
}

const removeProducto = (itemId) => {
if(Uid){
eliminarFav(itemId)
setContResumen(contResumen.filter(item => item.pkIdPS !== itemId));
}else{
RLSFavoritos(itemId)
setContResumen(contResumen.filter(item => item.pkIdPS !== itemId));
}
if (Uid) {
eliminarFav(itemId)
setContResumen(contResumen.filter(item => item.pkIdPS !== itemId));
} else {
RLSFavoritos(itemId)
setContResumen(contResumen.filter(item => item.pkIdPS !== itemId));
}
};
const RLSFavoritos = (id) => {
let favoritos = JSON.parse(localStorage.getItem("favoritos")) || [];
favoritos = favoritos.filter((obj) => obj.pkIdPS !== id);
localStorage.setItem("favoritos", JSON.stringify(favoritos));
};
};

const eliminarFav = async (idProServ) => {
try {
Expand Down Expand Up @@ -374,7 +374,7 @@ function ListaDeseo() {
return 0;
}
})


const contenido = filteredProducts.map(producto => (
<li key={producto.pkIdPS} className='grid border-4 bg-white border-[#E2B3B7] p-6 py-2 rounded-xl mx-6 mb-6'>
Expand Down Expand Up @@ -402,7 +402,7 @@ function ListaDeseo() {
<div>
<p className='mt-2 text-[#0BC26A] text-lg'>{'$' + producto.precio + ' MXN'}</p>
<Rating className='' value={producto.valoracion} readOnly unratedcolor="amber" ratedcolor="amber" />
<h3 className='mt-0 text-xl font-bold truncate'>{producto.nombre}</h3>
<h3 className='mt-0 text-xl font-bold'>{producto.nombre}</h3>
<p className='mt-0 text-xs text-justify'>
{producto.descripcion.length > 120 ? (
producto.descripcion.substring(0, 120) + '...'
Expand Down

0 comments on commit d064bab

Please sign in to comment.