LXC Url
This commit is contained in:
@@ -2,8 +2,8 @@ import React, { useEffect, useState, useContext } from 'react';
|
||||
import { Virtuoso } from 'react-virtuoso';
|
||||
import CardRow from '../components/CardRow/CardRow';
|
||||
import SearchBar from '../components/SearchBar/SearchBar';
|
||||
import { fetchCards } from '../services/api';
|
||||
import { CardContext } from '../store/CardContext';
|
||||
import { fetchCards, fetchCardImage } from '../services/api';
|
||||
|
||||
// Debounce hook
|
||||
function useDebouncedValue(value, delay = 250) {
|
||||
@@ -34,14 +34,12 @@ function HomePage() {
|
||||
}, []);
|
||||
|
||||
// Load image for the currently expanded card
|
||||
|
||||
useEffect(() => {
|
||||
if (!expandedCardId || cardImages[expandedCardId]) return;
|
||||
|
||||
fetch(`http://localhost:3000/cardImage/${expandedCardId}`)
|
||||
.then(res => res.json())
|
||||
.then(data => {
|
||||
if (data.image) setCardImage(expandedCardId, data.image);
|
||||
})
|
||||
fetchCardImage(expandedCardId)
|
||||
.then(image => setCardImage(expandedCardId, image))
|
||||
.catch(err => console.error('Failed to load card image', err));
|
||||
}, [expandedCardId, cardImages, setCardImage]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user