Add price & size to routes

This commit is contained in:
Edin Dazdarevic
2017-04-09 23:57:29 +02:00
parent 4df688ac60
commit 5f4e3a01d3
4 changed files with 61 additions and 11 deletions

View File

@@ -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" });
}