Making fetch API work with CORS after OPTIONS response
The immediate problem you’re hitting is, your code as currently written expects the response to be JSON but the response is actually a Promise that you need to handle to get the JSON.
So you need to instead do something like this:
fetch("https://example.com") .then(response => response.json()) .then(jsondata => console.log(jsondata))