I was having an API where I am calling a get request to send to query parameters through form data but I am getting get request doesn't take form data. How to do it
http://ihub-fastapi-solubility.herokuapp.com/predict?solute=CC(C)(C)Br&solvent=CC(C)(C)O
this is the URL and solute and solvent are the query parameters.
const onSubmit = (e) => {
e.preventDefault(); // <-- prevent the default form action
const formData = new FormData();
formData.set("solute", solutestate); // <-- local component state
formData.set("solvent", solventstate); // <-- local component state
console.log({ formData });
fetch("http://ihub-fastapi-solubility.herokuapp.com/predict", {
method: "get",
body: formData,
}).catch((err) => {
setError(err.error);
console.log(err);
});