If the backend support CORS, you probably need to add to your request this header:
headers: {"Access-Control-Allow-Origin": "*"}
Your code would be like this:
getPlayerInfo() {
const apiKey = "my-api-key";
const playerID = "41c44740-d0f6-44ab-8347-3b5d515e5ecf";
const url = `http://api.sportradar.us/nfl/official/trial/v5/en/players/${playerID}/profile.json?api_key=${apiKey}`;
const config = {
headers: {'Access-Control-Allow-Origin': '*'}
};
axios.get(url,config).then(response => console.log(response));
}
Hope this helps !
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…