Skip to content

Commit

Permalink
Fetch on search
Browse files Browse the repository at this point in the history
  • Loading branch information
M4RC02U1F4A4 committed Jan 28, 2024
1 parent d1ed59f commit 4c3c8c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 0 additions & 4 deletions frontend/public/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -756,10 +756,6 @@ video {
margin: 0px;
}

.m-4 {
margin: 1rem;
}

.mx-0 {
margin-left: 0px;
margin-right: 0px;
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/NavBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default function NavBar({ activePage, handleNavLinkClick }) {
const {isOpen, onOpen, onOpenChange} = useDisclosure();
const [searchTerm, setSearchTerm] = useState('');
const [searchResults, setSearchResults] = useState([]);
const {channelsData, statsData, fetchStatsData} = useDataContext();
const {channelsData, statsData, fetchStatsData, fetchVideosData, fetchChannelsData} = useDataContext();

const convertiSecondi = (secondi) => {
const days = Math.floor(secondi / (3600 * 24));
Expand Down Expand Up @@ -46,6 +46,7 @@ export default function NavBar({ activePage, handleNavLinkClick }) {
const response = await fetch(`${config.API_BASE_URL}/update/channels`);
console.log(response)
fetchStatsData()
fetchChannelsData()
} catch (error) {
console.error('Errore nella richiesta:', error);
}
Expand All @@ -56,6 +57,7 @@ export default function NavBar({ activePage, handleNavLinkClick }) {
const response = await fetch(`${config.API_BASE_URL}/update/videos`);
console.log(response)
fetchStatsData()
fetchVideosData()
} catch (error) {
console.error('Errore nella richiesta:', error);
}
Expand Down

0 comments on commit 4c3c8c6

Please sign in to comment.