Removes console log from header and subheader. Adds empty fecthonlt and fetchonly meta verifiction before loading items to ensure an empty array is passed.
This commit is contained in:
parent
e817d2761b
commit
0b0cdf0a45
|
@ -52,9 +52,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
openAdvancedSearchComponent(){
|
||||
console.log('Called here', this.$route.meta);
|
||||
this.$set(this.$route.meta, 'openAdvancedSearch', !this.$route.meta.openAdvancedSearch);
|
||||
console.log('Called here', this.$route.meta);
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
|
|
@ -366,7 +366,6 @@
|
|||
},
|
||||
computed: {
|
||||
openAdvancedSearch(){
|
||||
console.log('Called here', this.$route.meta);
|
||||
return this.$route.meta.openAdvancedSearch;
|
||||
},
|
||||
items() {
|
||||
|
@ -437,9 +436,7 @@
|
|||
'getTotalItems'
|
||||
]),
|
||||
openAdvancedSearchComponent(){
|
||||
console.log('Called here', this.$route.meta);
|
||||
this.$set(this.$route.meta, 'openAdvancedSearch', !this.$route.meta.openAdvancedSearch);
|
||||
console.log('Called here', this.$route.meta);
|
||||
},
|
||||
updateSearch() {
|
||||
this.$eventBusSearch.setSearchQuery(this.futureSearchQuery);
|
||||
|
|
|
@ -13,6 +13,13 @@ export const fetchItems = ({ rootGetters, dispatch, commit }, { collectionId, is
|
|||
if (postQueries.metaquery != undefined && postQueries.metaquery.length > 0)
|
||||
hasFiltered = true;
|
||||
|
||||
// Garanttees at least empty fetch_only are passed in case none is found
|
||||
if (qs.stringify(postQueries.fetch_only) == '')
|
||||
postQueries.fetch_only = {};
|
||||
|
||||
if (qs.stringify(postQueries.fetch_only['meta']) == '')
|
||||
postQueries.fetch_only['meta'] = [0];
|
||||
|
||||
// Differentiates between repository level and collection level queries
|
||||
let endpoint = '/collection/'+collectionId+'/items?'
|
||||
|
||||
|
@ -22,26 +29,23 @@ export const fetchItems = ({ rootGetters, dispatch, commit }, { collectionId, is
|
|||
if (!isOnTheme)
|
||||
endpoint = endpoint + 'context=edit&'
|
||||
|
||||
if (qs.stringify(postQueries.fetch_only['meta']) != '') {
|
||||
axios.tainacan.get(endpoint + qs.stringify(postQueries))
|
||||
.then(res => {
|
||||
axios.tainacan.get(endpoint + qs.stringify(postQueries))
|
||||
.then(res => {
|
||||
|
||||
let items = res.data;
|
||||
let viewModeObject = tainacan_plugin.registered_view_modes[postQueries.view_mode];
|
||||
let items = res.data;
|
||||
let viewModeObject = tainacan_plugin.registered_view_modes[postQueries.view_mode];
|
||||
|
||||
if (isOnTheme && viewModeObject != undefined && viewModeObject.type == 'template') {
|
||||
commit('setItemsListTemplate', items );
|
||||
resolve({'itemsListTemplate': items, 'total': res.headers['x-wp-total'], hasFiltered: hasFiltered});
|
||||
} else {
|
||||
commit('setItems', items );
|
||||
resolve({'items': items, 'total': res.headers['x-wp-total'], hasFiltered: hasFiltered});
|
||||
}
|
||||
dispatch('search/setTotalItems', res.headers['x-wp-total'], { root: true } );
|
||||
})
|
||||
.catch(error => reject(error));
|
||||
|
||||
if (isOnTheme && viewModeObject != undefined && viewModeObject.type == 'template') {
|
||||
commit('setItemsListTemplate', items );
|
||||
resolve({'itemsListTemplate': items, 'total': res.headers['x-wp-total'], hasFiltered: hasFiltered});
|
||||
} else {
|
||||
commit('setItems', items );
|
||||
resolve({'items': items, 'total': res.headers['x-wp-total'], hasFiltered: hasFiltered});
|
||||
}
|
||||
dispatch('search/setTotalItems', res.headers['x-wp-total'], { root: true } );
|
||||
})
|
||||
.catch(error => reject(error));
|
||||
} else {
|
||||
reject("No fecth_only meta was found.");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue