After using the Api it should return a response once the the image is uploaded.
But even though the image is uploaded i am not getting any rsponse through the api.
if (pic.type === "image/jpeg" || pic.type === "image/png") {
const data = new FormData();
data.append("file", pic)
data.append("upload_preset", "baatchitapp")
data.append("cloud_name", "******")
fetch("https://api.cloudinary.com/v1_1/******/image/upload", {
method: "post",
body: data,
})
.then((res) => {
res.json();
})
.then(data => {
console.log(data);
// setPic(data.url.toString());
setLoading(false);
})
.catch((err) => {
console.log("Error: ",err);
setLoading(false);
});
}