|
|
|
@@ -3,18 +3,23 @@ import PropTypes from "prop-types"; |
|
|
|
import { MarketPlaceContainer } from "./MarketPlace.styled"; |
|
|
|
import Header from "./Header/Header"; |
|
|
|
import Offers from "./Offers/Offers"; |
|
|
|
import { useDispatch } from "react-redux"; |
|
|
|
import { useDispatch, useSelector } from "react-redux"; |
|
|
|
import { useEffect } from "react"; |
|
|
|
import { fetchChats } from "../../store/actions/chat/chatActions"; |
|
|
|
import { selectUserId } from "../../store/selectors/loginSelectors"; |
|
|
|
|
|
|
|
const MarketPlace = (props) => { |
|
|
|
const [isGrid, setIsGrid] = useState(false); |
|
|
|
const userId = useSelector(selectUserId); |
|
|
|
const dispatch = useDispatch(); |
|
|
|
useEffect(() => { |
|
|
|
dispatch(fetchChats({ |
|
|
|
currentPage: 1, |
|
|
|
})); |
|
|
|
}, []) |
|
|
|
if (userId) |
|
|
|
dispatch( |
|
|
|
fetchChats({ |
|
|
|
currentPage: 1, |
|
|
|
}) |
|
|
|
); |
|
|
|
}, [userId]); |
|
|
|
const offers = props.offers; |
|
|
|
return ( |
|
|
|
<MarketPlaceContainer> |