Skip to content

Commit 16931a1

Browse files
fix: replaced Taxonomies().Query() with Taxonomies()
1 parent 02c2882 commit 16931a1

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/core/modules/taxonomy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const _extend = {
1818
}
1919
}
2020

21-
export default class TaxonomyQuery extends Query {
21+
export default class Taxonomy extends Query {
2222
constructor() {
2323
super();
2424
/**

src/core/stack.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as Utils from './lib/utils';
33
import Entry from './modules/entry';
44
import Assets from './modules/assets';
55
import Query from './modules/query';
6-
import TaxonomyQuery from './modules/taxonomy';
6+
import Taxonomy from './modules/taxonomy';
77
import Request from './lib/request';
88
import CacheProvider from './cache-provider/index';
99
let errorRetry = [408, 429]
@@ -360,7 +360,7 @@ export default class Stack {
360360
*/
361361
Taxonomies() {
362362
this.type = "taxonomy"
363-
return this;
363+
return Utils.merge(new Taxonomy(), this);
364364
}
365365

366366
/**
@@ -456,8 +456,11 @@ export default class Stack {
456456
* @instance
457457
*/
458458
Query() {
459-
let query = (this.type === "taxonomy" || this.type === "contentType") ?
460-
new TaxonomyQuery() :
459+
// Taxonomy is a class that extends Query class and adds 4 more helper methods that use levels.
460+
// These 4 methods also work on contentType base url, hence Taxonomy instance is returned
461+
// Taxonomy instance is Regular Query instance + 4 additional methods (below, eq_below, above, eq_above)
462+
let query = (this.type === "contentType") ?
463+
new Taxonomy() :
461464
new Query();
462465
return Utils.merge(query, this);
463466
}

0 commit comments

Comments
 (0)