trying out
This commit is contained in:
@@ -129,7 +129,7 @@ class Main extends React.Component {
|
||||
/*
|
||||
* Refreshes search
|
||||
*/
|
||||
refreshListings() {
|
||||
refreshListings(more = false) {
|
||||
console.log('refreshListings');
|
||||
|
||||
const map = this.map;
|
||||
@@ -150,7 +150,8 @@ class Main extends React.Component {
|
||||
maxSize,
|
||||
minPrice,
|
||||
maxPrice,
|
||||
category
|
||||
category,
|
||||
lastRecordId: this.state.lastRecordId
|
||||
});
|
||||
|
||||
|
||||
@@ -158,10 +159,19 @@ class Main extends React.Component {
|
||||
return this.findMarker(id) != null;
|
||||
}
|
||||
|
||||
properties.then(p => p.text()).then(p => {
|
||||
|
||||
properties
|
||||
.then(p => {
|
||||
const lastRecordId = p.headers.get('X-Last-Record-Id');
|
||||
console.log('lastRecordId', lastRecordId, p.headers);
|
||||
return {
|
||||
body: p.text(),
|
||||
lastRecordId: p.headers.get('X-Last-Record-Id')
|
||||
};
|
||||
})
|
||||
.then(({body, lastRecordId}) => {
|
||||
body.then(p => {
|
||||
console.log('results_received: ', body, lastRecordId);
|
||||
const data = JSON.parse(p);
|
||||
console.log('results_received');
|
||||
|
||||
const listingExists = (id) => {
|
||||
return data.findIndex(l => l._id === id) !== -1
|
||||
@@ -241,9 +251,12 @@ class Main extends React.Component {
|
||||
type: 'LISTINGS_LOADED',
|
||||
action: {
|
||||
listings: data,
|
||||
newMarkers
|
||||
newMarkers,
|
||||
lastRecordId,
|
||||
more
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
@@ -349,6 +362,7 @@ class Main extends React.Component {
|
||||
} else {
|
||||
children.push(<Filters filters={this.state.filters} dispatch={this.dispatch.bind(this)} onClose={this.onCloseClick.bind(this)}/>);
|
||||
children.push(<Listings
|
||||
loadingMore={this.state.loadingMore}
|
||||
listings={this.state.listings}
|
||||
dispatch={this.dispatch.bind(this)}
|
||||
/>);
|
||||
|
||||
Reference in New Issue
Block a user