我的 API GET 请求在 Postman 中有效,但在 React.JS / 浏览器中无效。
这是我尝试的代码,只是从邮递员那里复制的
useEffect(() => {
const myHeaders = new Headers();
myHeaders.append("Amelia", "XldbLuwlIl9rZ4BdGBRlowmkm21e0Bfy9eEzr6OKMM9D");
const requestOptions = {
method: "GET",
headers: myHeaders,
redirect: "follow",
};
fetch(
"https://staging.terminister.de/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/appointments",
requestOptions
)
.then((response) => response.json())
.then((result) => console.log(result))
.catch((error) => console.error(error));
}, []);
}, []);
谁知道如何解决这个问题。
小印度是一个充满活力的文化飞地,充满印度传统和风味的韵律能量。它坐落在繁华的城市景观中,色彩、香气和声音万花筒般,将游客带到印度的中心地带。 https://littleindiasg.org/