Fix filters using OR queries
This commit is contained in:
parent
f37b3ecd26
commit
f8201cd2bc
@ -379,6 +379,12 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
|
// if (this.$route.query.query) this.query = this.$route.query.query
|
||||||
|
// if (this.$route.query.facets) this.facets = this.$route.query.facets[0]
|
||||||
|
// if (this.$route.query.sortType) this.sortType = this.$route.query.sortType
|
||||||
|
//
|
||||||
|
// console.log(this.facets)
|
||||||
|
|
||||||
window.addEventListener('resize', this.resize)
|
window.addEventListener('resize', this.resize)
|
||||||
await this.resize()
|
await this.resize()
|
||||||
},
|
},
|
||||||
@ -430,7 +436,6 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let url = 'https://api.modrinth.com/api/v1/mod'
|
|
||||||
const params = [`limit=${this.maxResults}`, `index=${this.sortType}`]
|
const params = [`limit=${this.maxResults}`, `index=${this.sortType}`]
|
||||||
|
|
||||||
if (this.query.length > 0) {
|
if (this.query.length > 0) {
|
||||||
@ -438,13 +443,19 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.facets.length > 0) {
|
if (this.facets.length > 0) {
|
||||||
params.push(`facets=${JSON.stringify([this.facets])}`)
|
const formattedFacets = []
|
||||||
|
for (const facet of this.facets) {
|
||||||
|
formattedFacets.push([facet])
|
||||||
|
}
|
||||||
|
params.push(`facets=${JSON.stringify(formattedFacets)}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newPageNumber !== 1) {
|
if (newPageNumber !== 1) {
|
||||||
params.push(`offset=${(newPageNumber - 1) * this.maxResults}`)
|
params.push(`offset=${(newPageNumber - 1) * this.maxResults}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let url = 'https://api.modrinth.com/api/v1/mod'
|
||||||
|
|
||||||
if (params.length > 0) {
|
if (params.length > 0) {
|
||||||
for (let i = 0; i < params.length; i++) {
|
for (let i = 0; i < params.length; i++) {
|
||||||
url += i === 0 ? `?${params[i]}` : `&${params[i]}`
|
url += i === 0 ? `?${params[i]}` : `&${params[i]}`
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user