I'm doing an API get request via axios to an Exchange Rates API
(我正在通过axios向汇率API进行API获取请求)
axios.get('https://api.exchangerate-api.com/v4/latest/USD').then(res=>console.log('res',res)).catch(err => console.log('err',err))
And I'm getting the correct answer in the network
(而且我在网络中得到正确的答案)
But this is what shows on in my console for de ERR of the get request
(但这就是在控制台中显示的get请求的ERR错误)
I've researched that CORS message and all they say is, that you have to configure your server to accept the authorization header, but thats not an API to my server, it's a third party's server
(我已经研究了CORS消息,它们的意思是,您必须将服务器配置为接受授权标头,但这不是我的服务器的API,而是第三方的服务器)
What can I do?
(我能做什么?)
UPDATE
(更新)
I changed from "axios" from js "fetch" and it worked!
(我从js“ fetch”的“ axios”更改了,它起作用了!)
I think maybe it was a default axios configuration that was causing the problem (我认为可能是导致问题的默认axios配置)
ask by Sven Brodersen translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…