'Back to results' handled properly

This commit is contained in:
Edin Dazdarevic
2017-04-06 02:37:18 +02:00
parent f96cc50687
commit 21ec7c560d
3 changed files with 18 additions and 20 deletions

View File

@@ -185,6 +185,19 @@ const onListingMouseOver = ({type, action}, component) => {
};
const backToResults = ({type, action}, component) => {
const prevSelected = component.findMarker(component.state.listingId);
component.setState({
listingId: undefined,
listingDetails: false
}, () => {
if (prevSelected) {
prevSelected.marker.setIcon(component.visitedMarkerIcon());
}
});
}
const handlers = {
SET_MIN_PRICE: setMinPrice,
SET_MAX_PRICE: setMaxPrice,
@@ -200,7 +213,8 @@ const handlers = {
VIEW_LISTING_DETAILS: viewListingDetails,
UPDATE_SEARCH: updateSearch,
SET_CATEGORY: setCategory,
ON_LISTING_MOUSE_OVER: onListingMouseOver
ON_LISTING_MOUSE_OVER: onListingMouseOver,
BACK_TO_RESULTS: backToResults
};
export const handleMessage = ({ type, action }, component) => {