Skip to content

Commit

Permalink
Use URLSearchParams
Browse files Browse the repository at this point in the history
  • Loading branch information
jimchamp committed Jul 2, 2024
1 parent 4005e6e commit 6c85d8a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions openlibrary/plugins/openlibrary/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,11 @@ function fetchPartials(param) {
query: document.location.search
}
const dataString = JSON.stringify(data)
const dataQueryParam = encodeURIComponent(dataString)

return fetch(`/partials.json?_component=SearchFacets&data=${dataQueryParam}`)
return fetch(`/partials.json?${new URLSearchParams({
_component: 'SearchFacets',
data: dataString
})}`)
.then((resp) => {
if (!resp.ok) {
throw new Error(`Failed to fetch partials. Status code: ${resp.status}`)
Expand Down

0 comments on commit 6c85d8a

Please sign in to comment.