| @@ -2,11 +2,12 @@ import React, { useEffect } from "react"; | |||
| import { PropTypes } from "prop-types"; | |||
| import Navbar from "../../components/MUI/NavbarComponent"; | |||
| import { ItemDetailsPageContainer } from "./ItemDetailsPage.styled"; | |||
| import { useDispatch } from "react-redux"; | |||
| import { useDispatch, useSelector } from "react-redux"; | |||
| import ItemDetails from "../../components/ItemDetails/ItemDetails"; | |||
| import ItemDetailsLayout from "../../layouts/ItemDetailsLayout/ItemDetailsLayout"; | |||
| import UserReviewsCard from "../../components/UserReviewsCard/UserReviewsCard"; | |||
| import { fetchOneOffer } from "../../store/actions/offers/offersActions"; | |||
| import { selectOffer } from "../../store/selectors/offersSelectors"; | |||
| @@ -14,12 +15,20 @@ import { fetchOneOffer } from "../../store/actions/offers/offersActions"; | |||
| const ItemDetailsPage = (props) => { | |||
| const dispatch = useDispatch(); | |||
| const offer = useSelector(selectOffer); | |||
| const offerId = props.match.params.idProizvod; | |||
| useEffect(() => { | |||
| dispatch(fetchOneOffer(offerId)); | |||
| }, []); | |||
| }, [offerId]); | |||
| useEffect(() => { | |||
| if (typeof offer !== 'undefined' && typeof offer.userId !== 'undefined' && offer.userId !== '') { | |||
| console.log(offer.userId); | |||
| } | |||
| }, [offer]) | |||
| return ( | |||