Router in a good shape
This commit is contained in:
@@ -22,8 +22,22 @@ export default class Listings extends React.Component {
|
||||
}
|
||||
|
||||
onListingClick(id) {
|
||||
|
||||
|
||||
loadListing(id).then(l => l.text()).then(l => {
|
||||
console.log('listing loaded', l);
|
||||
console.log('lising clicked');
|
||||
this.props.dispatch({type: 'UPDATE_ROUTE', action: {
|
||||
toDispatch: {
|
||||
type: 'VIEW_LISTING_DETAILS', action: {
|
||||
id,
|
||||
listing: JSON.parse(l)
|
||||
}
|
||||
},
|
||||
params: {
|
||||
listingId: id
|
||||
}
|
||||
}});
|
||||
|
||||
this.props.dispatch({type: 'VIEW_LISTING_DETAILS', action: {
|
||||
id,
|
||||
listing: JSON.parse(l)
|
||||
@@ -108,6 +122,12 @@ export default class Listings extends React.Component {
|
||||
}
|
||||
|
||||
onSortChange (e) {
|
||||
this.props.dispatch({type: 'UPDATE_ROUTE', action: {
|
||||
params: {
|
||||
sort: e.target.value
|
||||
}
|
||||
}});
|
||||
|
||||
this.props.dispatch({type: 'SORT_CHANGE', action: {
|
||||
sort: e.target.value
|
||||
}});
|
||||
|
||||
Reference in New Issue
Block a user