0👍
Yes, you can do it like that.
However, it seems that the API you’re contacting does not allow the header content-type
in its CORS
policy. This header was included because you’re doing a POST
request containing some data.
You could try setting mode
to no-cors
but you should note that this does not guarantee that it works.
fetch('https://api.....', { method: 'POST', data: JSON.stringify({}), "mode": "no-cors" })
Source:stackexchange.com