Load listing details from the server
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import {formatPrice} from '../lib/helpers';
|
||||
import {loadListing} from '../lib/api';
|
||||
|
||||
export default class Listings extends React.Component {
|
||||
constructor(props) {
|
||||
@@ -32,12 +33,22 @@ export default class Listings extends React.Component {
|
||||
}
|
||||
|
||||
onListingClick(id) {
|
||||
this.props.dispatch({
|
||||
type: 'VIEW_LISTING_DETAILS',
|
||||
action: {
|
||||
id
|
||||
}
|
||||
|
||||
loadListing(id).then(l => l.text()).then(l => {
|
||||
console.log('listing loaded', l);
|
||||
this.props.dispatch({type: 'VIEW_LISTING_DETAILS', action: {
|
||||
id,
|
||||
listing: JSON.parse(l)
|
||||
}});
|
||||
});
|
||||
|
||||
|
||||
//this.props.dispatch({
|
||||
//type: 'VIEW_LISTING_DETAILS',
|
||||
//action: {
|
||||
//id
|
||||
//}
|
||||
//});
|
||||
}
|
||||
|
||||
onMouseEnter (id) {
|
||||
|
||||
Reference in New Issue
Block a user