Handles invalid orderby 'name' in the store.
This commit is contained in:
parent
479e153700
commit
c627bed216
|
@ -96,7 +96,11 @@ export const setOrderBy = ({ state, commit }, orderBy ) => {
|
|||
commit('removePostQueryAttribute', 'metakey');
|
||||
commit('removePostQueryAttribute', 'metatype');
|
||||
|
||||
if (orderBy.metakey) {
|
||||
// This first if is to handle situations where a collection was created
|
||||
// with the invalid default of 'name'
|
||||
if (orderBy == 'name' || (order.metakey && order.metakey == 'name') ) {
|
||||
commit('setPostQueryAttribute', { attr: 'orderby', value: 'date' } );
|
||||
} else if (orderBy.metakey) {
|
||||
Object.keys(orderBy).forEach((paramKey) => {
|
||||
commit('setPostQueryAttribute', { attr: paramKey, value: orderBy[paramKey] });
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue