Hi!
I have tried to add POST request in the additional scripts, but I have an error: "SyntaxError: Unexpected end of input ".
I have added to the fetch’s config “mode: ‘no-cors’”, but it still not working. What I’m doing wrong?
Do I need to create an App for it? If yes, how I can add the script to the order status page?
async function myFetch() {
try {
const data = {
"email": "test@gmail.com",
"code": "2IQ46Z5YBO"
}
const config = {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
mode: 'no-cors',
body: JSON.stringify(data)
}
let response = await fetch('https://s6rn91hrs3.execute-api.us-east-2.amazonaws.com/campaigns/claim', config);
let result = await response.json();
console.log(response)
} catch(e) {
console.log(e);
}
}
myFetch();