diff --git a/pages/mods.vue b/pages/mods.vue index 7b835370c..38e55d5f7 100644 --- a/pages/mods.vue +++ b/pages/mods.vue @@ -379,6 +379,12 @@ export default { } }, 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) await this.resize() }, @@ -430,7 +436,6 @@ export default { } try { - let url = 'https://api.modrinth.com/api/v1/mod' const params = [`limit=${this.maxResults}`, `index=${this.sortType}`] if (this.query.length > 0) { @@ -438,13 +443,19 @@ export default { } 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) { params.push(`offset=${(newPageNumber - 1) * this.maxResults}`) } + let url = 'https://api.modrinth.com/api/v1/mod' + if (params.length > 0) { for (let i = 0; i < params.length; i++) { url += i === 0 ? `?${params[i]}` : `&${params[i]}`