Когда делаю запрос через postman на
https://ifyouhavemoneyforbitcoin.herokuapp.com, то получаю нормальный результат, но когда пытаюсь через
axiosOPTIONS https://ifyouhavemoneyforbitcoin.herokuapp.com/ 404 (Not Found)
dispatchXhrRequest @ xhr.js:173
xhrAdapter @ xhr.js:18
dispatchRequest @ dispatchRequest.js:49
Promise.then (async)
request @ Axios.js:55
Axios.(anonymous function) @ Axios.js:74
...
localhost/:1 Failed to load https://ifyouhavemoneyforbitcoin.herokuapp.com/: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3001' is therefore not allowed access.
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3001' is therefore not allowed access.
Что я делаю не так?
axios
.post('https://ifyouhavemoneyforbitcoin.herokuapp.com', { time: Date.now() })
.then(({ data: bitcoin }) => {
console.log("sdf", bitcoin);
return bitcoin.cost
})
.then(bitcoin => {
this.setState({
data: addDataPoint(data, bitcoin, time)
});
})
.catch(err => {
console.error(err);
});