I am basically trying to update a collection in Adalo from my frontend application coded in ReactJS. I am using the following code to achieve the same -
const saveToAdaloPayload = {
"Description": "Project description",
};
const saveToAdaloResponse = fetch('https://api.adalo.com/v0/apps/<appId>/collections/<collectionId>', {
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer <secret API key>',
},
method: 'POST',
body: saveToAdaloPayload,
})
.then((result) => {
if (result.ok) {
return result;
}
}).catch((err) => {
console.log(err);
});
I get the following error -
Access to fetch at 'https://api.adalo.com/v0/apps/<appId>/collections/<collectionId>'
from origin 'http://localhost:3000'
has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
If I try to set the request’s mode to ‘no-cors’, then I get a 401 ‘unauthorised error’. Please guide me on this.