I am trying to retrieve the response from an API, but after using
fetch("url").then(res=>res.json()),
I am getting unexpected end of input error in my code at the following line:
res => res.json(),
Please find below code and help me locate exactly where am i going wrong:-
static fetchCurrentServices(){
return fetch("http://localhost:8080/portal-backend/services", {
mode: "no-cors",
method: "GET" ,
headers: {
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json"
}
})
.then(
res => res.json()
).catch(function (ex) {
console.log('parsing failed', ex)
});
}