Prepares components for new object of last_term.

This commit is contained in:
mateuswetah 2020-06-29 11:47:11 -03:00
parent 53ce3532ff
commit e6d11d5d5a
3 changed files with 9 additions and 9 deletions

View File

@ -471,7 +471,7 @@
if (this.isUsingElasticSearch) {
this.checkboxListOffset = res.data.last_term;
this.checkboxListOffset = res.data.last_term.es_term;
if (!this.lastTermOnFisrtPage || this.lastTermOnFisrtPage == this.checkboxListOffset) {
this.lastTermOnFisrtPage = this.checkboxListOffset;
@ -582,7 +582,7 @@
this.totalRemaining = Object.assign({}, this.totalRemaining, {
[`${column == undefined ? 0 : column+1}`]: {
remaining: this.isUsingElasticSearch ? (children.length > 0 ? res.data.last_term != '' : false) : res.headers['x-wp-total'],
remaining: this.isUsingElasticSearch ? (children.length > 0 ? res.data.last_term.value == children[children.length - 1].value : false) : res.headers['x-wp-total'],
}
});
@ -598,9 +598,9 @@
}
if (first != undefined) {
this.finderColumns.splice(first, 1, { children: children, lastTerm: res.data.last_term });
this.finderColumns.splice(first, 1, { children: children, lastTerm: res.data.last_term.es_term });
} else {
this.finderColumns.push({ children: children, lastTerm: res.data.last_term });
this.finderColumns.push({ children: children, lastTerm: res.data.last_term.es_term });
}
},
appendMore(options, key, lastTerm) {
@ -673,11 +673,11 @@
axios.get(route)
.then(res => {
this.appendMore(res.data.values, key, res.data.last_term);
this.appendMore(res.data.values, key, res.data.last_term.es_term);
this.totalRemaining = Object.assign({}, this.totalRemaining, {
[`${key}`]: {
remaining: this.isUsingElasticSearch ? (res.data.values.length > 0 ? (res.data.last_term == res.data.values[res.data.values.length - 1].value) : false) : res.headers['x-wp-total'],
remaining: this.isUsingElasticSearch ? (res.data.values.length > 0 ? (res.data.last_term.value == res.data.values[res.data.values.length - 1].value) : false) : res.headers['x-wp-total'],
}
});

View File

@ -266,7 +266,7 @@ export default {
this.isLoading = false;
this.totalFacets = Number(response.headers['x-wp-total']);
this.lastTerm = response.data.values.length > 0 ? response.data.last_term : '';
this.lastTerm = response.data.values.length > 0 ? response.data.last_term.es_term : '';
}).catch(() => {
this.isLoading = false;

View File

@ -80,7 +80,7 @@ export default class ParentTermModal extends React.Component {
modalFacets: otherModalFacets,
totalModalFacets: response.headers['x-wp-total'],
offset: this.state.offset + response.data.values.length,
lastTerm: response.data.last_term
lastTerm: response.data.last_term.es_term
});
return otherModalFacets;