Hello,
I’ve developing the extension for order-details action. The goal is to select the order and click function, fetch order number to Laravel API.
The program can’t get JSON response, but other public API can get response. I don’t know what i am missing.
const sendRequest = async (orderId) => {
fetch({Laravel_API}, {
method: "POST",
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ "order": orderId }),
mode: 'no-cors',
})
.then(response => response.json())
.then(json => {
// `text` is a string
console.log(json);
})
.catch(error => {
console.error('Error:', error);
});;
};