0

I had a problem is that when I type **console.log(response.data) **It should show me an object Containing many arrays, but its place shows me an error: Uncaught (in promise) => I get this error in the console

Knowing that there is no error in my API because when I try it in postman it brings the correct parameters.

this is my code :

const baseUrl = "https://....";

function getStandings() {
  const url = `${baseUrl}/standings`

  axios.get(url, {
    headers: {
      "X-Auth-Token": `${token}`
    }
  })
  .then((response) => {
    console.log(response.data)
  });

}

getStandings();

⚠ note : token and baseUrl they correct.

It goes in the error and I log it to the console. This is what I get::

message: 'Network Error', name: 'AxiosError', code: 'ERR_NETWORK', config: {…}, request: XMLHttpRequest, …

1 Answers1

2

I found the solution, only the problem was with CORS I had to enter from a browser that does not support it to show me the result of the API.

This site helped me a lot => Run Chrome browser without CORS