每次我运行这段代码:
async function Summoner_V4(region, summonerName) {
const url = `https://${region}.api.riotgames.com/lol/summoner/v4/summoners/by-name/${summonerName}?api_key=${api_key}`;
const response = await fetch(url);
const data = await response.json();
return data
}
我得到 3 个错误。
错误一:
Access to fetch at 'https://euw1.api.riotgames.com/lol/summoner/v4/summoners/by-name/Monkvy?api_key={myapikey}' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
错误2:
Failed to load resource: net::ERR_FAILED
错误 3:
Uncaught (in promise) TypeError: Failed to fetch
请heeeelp 我不知道该怎么办