2

I am trying to fetch data using API in react.js. My code is like below

import Axios from 'axios';

export const getCountry = () => dispatch => {
  return Axios.get('http://treeoverflow.com/api/country/listing/true/111111111111222222222222333333333333444444444444', { crossdomain: true })
  .then(response => {
    console.log(response.data);
    var countryData = response.data;
    dispatch({
      type: 'getCountries',
      payload: countryData
    });
  })
  .catch(function(error) {
    console.log('hello');
    dispatch({
      type: 'getCountryError',
      payload: error
    });
  });
};

export default { getCountry };

I getting below view in Network tab.

enter image description here

But I am not getting result. Is there any issue in this URL 'http://treeoverflow.com/api/country/listing/true/111111111111222222222222333333333333444444444444' ?

abu abu
  • 6,599
  • 19
  • 74
  • 131

0 Answers0