const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
const raw = JSON.stringify({
"store_code": "3045",
"f1": [
{
"pc": "102",
"pn": "A1",
"pp": "1.0",
"f1": "Z001",
"f2": "製作中"
}
],
"is_base64": "0",
"sign": "80805d794841f1b4"
});
const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("http://47.106.233.11/api/default/product/create_multiple", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
把myHeaders 移除試試看呢?
const raw = JSON.stringify({
"store_code": "3045",
"f1": [
{
"pc": "102",
"pn": "A1",
"pp": "1.0",
"f1": "Z001",
"f2": "製作中"
}
],
"is_base64": "0",
"sign": "80805d794841f1b4"
});
const requestOptions = {
method: "POST",
body: raw,
redirect: "follow"
};
fetch("http://47.106.233.11/api/default/product/create_multiple", requestOptions)
.then(response => response.json()) // 改為解析為JSON
.then(result => console.log(result))
.catch(error => console.error(error));