getCarouselData: async (params) => {
let bodyFormData = new FormData();
for (let key in params) {
bodyFormData.append(key, params[key]);
}
return axios({
method: "post",
url: `${baseURL}/getCarouselData`,
data: bodyFormData,
headers: { "Content-Type": `multipart/form-data;};` },
});
};
In the nextjs am calling the API by axios method.
If I set the content-type as "Content-Type":
multipart/form-data;
am getting 'content-type missing boundary' error.If I set the content-type as "Content-Type":
multipart/form-data; boundary=${bodyFormData.getBoundary()};
am getting bodyFormData.getBoundary is not a function
3)If I remove the content-type entirely "header:{}" or without header parameter am getting "unsupported content-type" error
How to solve this issue. But in the both methods am getting the response from the API after the error display.