I am trying to use the query string with axios to filter some data from the backend, I can do it with the backend api but I was struggling when it came to the frontend with react on how to send the array of query string to the backend. Here is my backend endpoint with array of query string params, it is working fine when I tested with postman.
localhost:3040/v2/feedback/filter/average-ratings?receiver=62c2dd106742823a69f98dac&receiver=62aec70881e46a4794b3a424
Here is my frontend code that I tried to send the request but return the error
export const filterAverageRating = async (receiver) => {
console.log('Receiver ID', receiver); //['62c2dd106742823a69f98dac', '62aec70881e46a4794b3a424']
const accessJWT = sessionStorage.getItem('accessJWT');
const config = {
headers: {
'Content-Type': 'application/json',
Authorization: accessJWT,
},
};
const { data } = await axios.get(
ENDPOINT_URL + 'filter/average-ratings',
config,
{ params: { receiver } }
);
return data;
};
it return receiver is undefined from the backend, it means that there is something went wrong with query string in axios.

No contentstatus 204 and it seem not get the query string from the axioshttp://localhost:3040/v2/feedback/filter/average-ratingsbecause it doesn't show the query string in the url endpoint.