Hi,
I’m using wix-fetch to target an external API.
It works, the API received the request, nothing wrong.
But when I want to take the callback (if I don’t use await, it returns a Promise, good) it returns nothing, no statut code or anything else.
See the code here :
export function post(datas){
return fetch(“https://api.mysite/send”, {
method: ‘POST’,
headers: {
‘Content-Type’: ‘application/json’,
‘security’: ‘mysecurekey’ },
body: JSON.stringify({
“data”:datas
})
})
}
and using :
const httpRes = await post(datas);
console.log(httpRes); //Returns a Promise