Add price & size to routes
This commit is contained in:
@@ -15,16 +15,20 @@ export default class Filters extends React.Component {
|
||||
}
|
||||
|
||||
onMaxPriceChange(e) {
|
||||
const maxPrice = e.target.value;
|
||||
|
||||
this.props.dispatch({
|
||||
type: "SET_MAX_PRICE",
|
||||
action: { maxPrice: e.target.value }
|
||||
action: {maxPrice}
|
||||
});
|
||||
}
|
||||
|
||||
onMinPriceChange(e) {
|
||||
const minPrice = e.target.value;
|
||||
|
||||
this.props.dispatch({
|
||||
type: "SET_MIN_PRICE",
|
||||
action: { minPrice: e.target.value }
|
||||
action: {minPrice}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -60,6 +64,7 @@ export default class Filters extends React.Component {
|
||||
}
|
||||
|
||||
onRefreshClick() {
|
||||
|
||||
this.updateSearch();
|
||||
}
|
||||
|
||||
@@ -70,6 +75,19 @@ export default class Filters extends React.Component {
|
||||
}
|
||||
|
||||
updateSearch () {
|
||||
const {minPrice, maxPrice, minSize, maxSize} = this.props.filters;
|
||||
|
||||
this.props.dispatch({
|
||||
type: 'UPDATE_ROUTE',
|
||||
action: {
|
||||
params: {
|
||||
minPrice,
|
||||
maxPrice,
|
||||
minSize,
|
||||
maxSize
|
||||
}
|
||||
}
|
||||
});
|
||||
this.props.dispatch({ type: "UPDATE_SEARCH" });
|
||||
}
|
||||
|
||||
|
||||
@@ -25,15 +25,19 @@ class Main extends React.Component {
|
||||
|
||||
if (props.initialState) {
|
||||
props.initialState.sort = props.initialState.sort || state.sort;
|
||||
state.filters.rooms = props.initialState.rooms;
|
||||
state.filters.category = props.initialState.category;
|
||||
state.sort = props.initialState.sort || state.sort;
|
||||
state.listingId = props.initialState.listingId;
|
||||
state.bounds = props.initialState.bounds;
|
||||
state.zoom = props.initialState.zoom;
|
||||
state.filters.rooms = props.initialState.rooms;
|
||||
state.filters.category = props.initialState.category;
|
||||
state.sort = props.initialState.sort || state.sort;
|
||||
state.listingId = props.initialState.listingId;
|
||||
state.bounds = props.initialState.bounds;
|
||||
state.zoom = props.initialState.zoom;
|
||||
if (state.listingId) {
|
||||
state.listingDetails = true;
|
||||
}
|
||||
state.filters.minSize = props.initialState.minSize;
|
||||
state.filters.maxSize = props.initialState.maxSize;
|
||||
state.filters.minPrice = props.initialState.minPrice;
|
||||
state.filters.maxPrice = props.initialState.maxPrice;
|
||||
}
|
||||
|
||||
this.state = state;
|
||||
|
||||
Reference in New Issue
Block a user