Skip to content

Commit

Permalink
Fixed name error
Browse files Browse the repository at this point in the history
  • Loading branch information
Felipe-Perez-Ferraro committed Dec 14, 2023
1 parent 47b01a2 commit fb8c099
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/pages/MyReservations.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@ import React, { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { getReservations } from '../../redux/reservations/reservationsSlice';
import { selectUser } from '../../redux/usersession/usersessionsSlice';
import { fetchBoats, selectAllBoats } from '../../redux/boats/boatsSlice';

function MyReservations() {
const { reservations } = useSelector((state) => state.reservations);
const user = useSelector(selectUser);
const dispatch = useDispatch();
const userReservations = reservations.filter((e) => e.username === user.name);
const boats = useSelector(selectAllBoats);
console.log(boats);

useEffect(() => {
dispatch(getReservations());
dispatch(fetchBoats());
}, [dispatch]);

return (
Expand All @@ -34,7 +38,7 @@ function MyReservations() {
!
You reserved
{' '}
{re.boat.name}
{boats.find(({ id }) => id === re.boat_id).name}
.
</h2>
<p className="text-lg font-semibold">
Expand Down

0 comments on commit fb8c099

Please sign in to comment.