Reputation: 2991
Who is right? Chrome or Edge and how do I fix it? Do I need to change the webpack configuration to make it compensate for this issue?
See screenshots below - undefined
is being passed to new Headers()
Chrome doesn't care but Edge throws error invalid argument
and crashes entire app
Upvotes: 0
Views: 274
Reputation: 3551
Because IE (Edge is just dressed up IE, lets face it) is the bane of all our existences..
Just ensure the object you are passing isn't undefined. You can use javascripts truthy-ness to do this easily.
else {
return new Headers(headers || {});
}
Looks like this is coming from Apollo-Link-Rest. Just create your RestLink like this instead
const restLink = new RestLink({
uri: 'https://swapi.co/api/',
headers: {},
});
Upvotes: 1