Basic pagination working
This commit is contained in:
@@ -13,6 +13,7 @@ class Main extends React.Component {
|
||||
listingDetails: false,
|
||||
listings: (new Map()),
|
||||
imageIndex: 0,
|
||||
page: 0,
|
||||
filters: {
|
||||
rooms: {},
|
||||
category: {}
|
||||
@@ -89,7 +90,8 @@ class Main extends React.Component {
|
||||
|
||||
map.addListener('idle', () => {
|
||||
console.log('idle');
|
||||
this.refreshListings();
|
||||
this.dispatch({type: 'MAP_IDLE'});
|
||||
//this.refreshListings();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -151,7 +153,7 @@ class Main extends React.Component {
|
||||
minPrice,
|
||||
maxPrice,
|
||||
category,
|
||||
lastRecordId: this.state.lastRecordId
|
||||
page: this.state.page
|
||||
});
|
||||
|
||||
|
||||
@@ -161,16 +163,14 @@ class Main extends React.Component {
|
||||
|
||||
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')
|
||||
totalCount: p.headers.get('X-Total-Count')
|
||||
};
|
||||
})
|
||||
.then(({body, lastRecordId}) => {
|
||||
.then(({body, totalCount}) => {
|
||||
body.then(p => {
|
||||
console.log('results_received: ', body, lastRecordId);
|
||||
console.log('results_received: ', totalCount);
|
||||
const data = JSON.parse(p);
|
||||
|
||||
const listingExists = (id) => {
|
||||
@@ -252,8 +252,8 @@ class Main extends React.Component {
|
||||
action: {
|
||||
listings: data,
|
||||
newMarkers,
|
||||
lastRecordId,
|
||||
more
|
||||
more,
|
||||
totalCount
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -362,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
|
||||
totalCount={this.state.totalCount}
|
||||
loadingMore={this.state.loadingMore}
|
||||
listings={this.state.listings}
|
||||
dispatch={this.dispatch.bind(this)}
|
||||
|
||||
Reference in New Issue
Block a user