I’ve noticed while trying to use the fetch() function in client side “Page” code AND in a server-side Web Module that it is hitting the endpoint twice for each invocation… The page I have been using to test this on, once it was discovered, is an empty page with this very basic JS… Can anyone imagine why this would be happening?
import {fetch} from ‘wix-fetch’;
$w.onReady( function () {
let getAccessTokenReq = “{test-endpoint-goes-here}”;
**let** options = {
method :'POST',
body :'Hello World'
}
console.log(
fetch(getAccessTokenReq, options).then(response => response.json())
);
});