Load listing details from the server
This commit is contained in:
@@ -3,7 +3,7 @@ import Filters from './Filters';
|
||||
import Listings from './Listings';
|
||||
import ListingDetails from './ListingDetails';
|
||||
import { pacSelectFirst } from '../helpers/googleMaps';
|
||||
import { loadProperties, loadSeen } from '../lib/api'
|
||||
import { loadProperties, loadSeen, loadListing} from '../lib/api'
|
||||
import { handleMessage } from '../lib/handlers'
|
||||
|
||||
class Main extends React.Component {
|
||||
@@ -195,7 +195,7 @@ class Main extends React.Component {
|
||||
const marker = new google.maps.Marker({
|
||||
position : myLatLng,
|
||||
map : map,
|
||||
title : prop.title,
|
||||
//title : prop.title,
|
||||
icon : this.isSeen(prop._id) ? this.visitedMarkerIcon() : this.defaultMarkerIcon(),
|
||||
id : prop._id
|
||||
});
|
||||
@@ -231,9 +231,15 @@ class Main extends React.Component {
|
||||
}
|
||||
|
||||
marker.setIcon(this.selectedMarkerIcon());
|
||||
this.dispatch({type: 'VIEW_LISTING_DETAILS', action: {
|
||||
id: prop._id
|
||||
}});
|
||||
|
||||
loadListing(prop._id).then(l => l.text()).then(l => {
|
||||
console.log('listing loaded', l);
|
||||
this.dispatch({type: 'VIEW_LISTING_DETAILS', action: {
|
||||
id: prop._id,
|
||||
listing: JSON.parse(l)
|
||||
}});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
newMarkers.push({
|
||||
@@ -402,7 +408,7 @@ class Main extends React.Component {
|
||||
|
||||
if (this.state.listingDetails) {
|
||||
console.log('CURRENT LISTINGS', this.state.listings);
|
||||
const listing = this.state.listings.get(this.state.listingId);
|
||||
const listing = this.state.listing; //this.state.listings.get(this.state.listingId);
|
||||
console.log(this.state);
|
||||
children.push(<ListingDetails
|
||||
listing={listing}
|
||||
|
||||
Reference in New Issue
Block a user