I want to make a get request from my component. I am currently making it inside componentWillMount method. So this component is the second page of application. First page is the login page. When I click on the login button on the first page then this page comes. I am getting the error while making the GET request. Here is how I am making the request
componentWillMount = ()=> {
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api/v1/workgroups/",
"method": "GET",
"headers": {
Authorization: "Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b"
},
success: function( data, textStatus, jQxhr ){
alert("success");
},
}
$.ajax(settings).done((response) => {
alert("yo");
console.log('check');
// this.context.router.push('/app')
});
}
Here are images of network and console tabs
The error message says that name resolution failed, so your system doesn't know how to convert
api
to an ip address.You can either:
hosts
file