I've been trying to filter any search by location and distance via JavaScript but I can't seem to figure out where to add this code in the fetch request:'filterRadius': {'postalcode': 48420,'miles': 25}This is what my fetch looks like without me trying to filter(this works):fetch(apiURL, {method: 'GET',headers: {'Content-Type': 'application/vnd.api+json','Authorization': apiKey}})I've tried adding body: after the headers section and adding it there(no luck).I've tried adding adding just the snippet after the headers section with and without the quotes around filterRadius(no luck).I'm lost on what to do. The documentation isn't specific enough for a beginner to know how to implement the filterRadius in JS. It mentions putting it in the POST data, which I think would be that section even when trying to do a GET request.Please help me
If I change the method to POST, I get 405 Method Not Allowed error in the browser's console.Also if I use that code like this:fetch(apiURL, {method: 'POST',
headers: {'Content-Type': 'application/vnd.api+json','Authorization': apiKey
},{'data':{
'filterRadius': {'postalcode': 48420,'miles': 25}}}
})I get a "Property assignment expected." error in the editor.
Here is my revised code. It now allows the POST method after I changed the url. I added the body property. Now the error I get is 400, saying the data provided is not valid JSON