Fixes to Terms Carousel. #308

This commit is contained in:
Mateus Machado Luna 2019-10-15 15:23:32 -03:00
parent f43b49fe80
commit d21802f84f
2 changed files with 4 additions and 3 deletions

View File

@ -240,7 +240,7 @@ export default {
this.termsRequestSource = axios.CancelToken.source();
let endpoint = '/taxonomy/' + this.taxonomyId + '/terms/?'+ qs.stringify({ include: this.selectedTerms }) + '&fetch_only=name,url,header_image';
let endpoint = '/taxonomy/' + this.taxonomyId + '/terms/?'+ qs.stringify({ include: this.selectedTerms }) + '&fetch_only=id,name,url,header_image';
this.tainacanAxios.get(endpoint, { cancelToken: this.termsRequestSource.token })
.then(response => {

View File

@ -210,7 +210,7 @@ registerBlockType('tainacan/carousel-terms-list', {
terms = [];
let endpoint = '/taxonomy/' + taxonomyId + '/terms/?'+ qs.stringify({ include: selectedTerms }) + '&fetch_only=name,url,header_image';
let endpoint = '/taxonomy/' + taxonomyId + '/terms/?'+ qs.stringify({ include: selectedTerms }) + '&fetch_only=id,name,url,header_image';
tainacan.get(endpoint, { cancelToken: itemsRequestSource.token })
.then(response => {
@ -227,8 +227,9 @@ registerBlockType('tainacan/carousel-terms-list', {
} else {
let promises = [];
for (let term of response.data) {
console.log(term)
promises.push(
tainacan.get('/items/?perpage=3&fetch_only=name,url,thumbnailt&taxquery[0][taxonomy]=tnc_tax_' + taxonomyId + '&taxquery[0][terms][0]=' + term.id + '&taxquery[0][compare]=IN')
tainacan.get('/items/?perpage=3&fetch_only=name,url,thumbnail&taxquery[0][taxonomy]=tnc_tax_' + taxonomyId + '&taxquery[0][terms][0]=' + term.id + '&taxquery[0][compare]=IN')
.then(response => { return({ term: term, termItems: response.data.items }) })
.catch((error) => console.log(error))
);