Passes taxquery to store when coming from a term items list.

This commit is contained in:
Mateus Machado Luna 2018-11-14 08:57:21 -02:00
parent 45c5e743d2
commit f6f3898373
1 changed files with 10 additions and 13 deletions

View File

@ -9,6 +9,16 @@ export const fetchItems = ({ rootGetters, dispatch, commit }, { collectionId, is
return new Object({
request: new Promise ((resolve, reject) => {
// Sets term query in case it's on a term items page
if (termId != undefined && taxonomy != undefined) {
dispatch('search/add_taxquery', {
taxonomy: taxonomy,
terms:[ termId ],
compare: 'IN'
}, { root: true });
}
// Adds queries for filtering
let postQueries = JSON.parse(JSON.stringify(rootGetters['search/getPostQuery']));
@ -30,19 +40,6 @@ export const fetchItems = ({ rootGetters, dispatch, commit }, { collectionId, is
}
}
// Sets term query in case it's on a term items page
if (termId != undefined && taxonomy != undefined) {
if (postQueries.taxquery == undefined || postQueries.taxquery.length == undefined)
postQueries.taxquery = new Array();
postQueries.taxquery.push({
taxonomy: taxonomy,
terms:[ termId ],
compare: 'IN'
});
}
let query = qs.stringify(postQueries);