JSFiddle - React, Tailwind, and code Playground
by Kai_Draord
JavaScript
canLoadNextbatch = true;
loadNextBatch() {
console.log('scrolldown');
this.pageIndex = this.pageIndex + 1;
if (this.canLoadNextbatch) {
this.global.getData(`/conditions/latest?start=${this.pageIndex}&length=${this.pageSize}`)
.pipe(take(1)).subscribe(res => {
const newBatch = res['data'];
if (newBatch.length === 0) {
this.canLoadNextbatch = false;
} else {
this.tempThermometer.next(this.tempThermometer.getValue().concat(newBatch));
console.log(this.tempThermometer);
}
});
}
}