Skip to content

Commit

Permalink
Merge pull request #186 from ctc-uci/177-volunteer-side-home-page-bug…
Browse files Browse the repository at this point in the history
…-fix

Volunteer side home page Bug Fix
  • Loading branch information
NwinNwin authored Apr 29, 2024
2 parents d863d33 + 90cdc4e commit 75bfc14
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/pages/VolunteerHomePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { SearchIcon, HamburgerIcon } from '@chakra-ui/icons';

import EventCard from '../components/Events/EventCard';
import VolunteerImpactSummary from '../components/Events/VolunteerImpactSummary';
import UserContext from '../utils/UserContext';
import Backend from '../utils/utils';
import Fuse from 'fuse.js';
import NavbarContext from '../utils/NavbarContext';
Expand All @@ -29,9 +30,14 @@ const VolunteerHomePage = () => {

const { onNavbarDrawerOpen } = useContext(NavbarContext);

const { user, updateUser } = useContext(UserContext);

const getEvents = async () => {
try {
const eventsData = await Backend.get('/events');
let userId = user?.id;

const eventsData = await Backend.get(`data/registered/${userId}`);
console.log(eventsData);
setEvents(eventsData.data);
const options = { keys: ['name', 'date', 'location'], includeScore: true };
setFuse(new Fuse(eventsData.data, options));
Expand All @@ -47,6 +53,7 @@ const VolunteerHomePage = () => {
));

useEffect(() => {
updateUser();
getEvents();
}, []);

Expand Down

0 comments on commit 75bfc14

Please sign in to comment.