We are calling a 3rd party api using {fetch}
The request is going to heroku
Heroku is returning the json
We are displaying the data in the repeater
If the data is being fetched and processed befor 14 seconds, the contents are displayed properly
If it is taking more than 14 seconds, then the error is being showed (Unhandled promise rejection Error: WebMethod request timed-out after 14 seconds… Did you forget to resolve a promise?)
The contents are coming in json, but cannot be displayed because of the timeout
We have searched all around the net to set the timeout, but couln’t find anything useful
May you all please help us out here?
Snippet of the code:
export function getResults(area,city,sdate,smonth,syear,edate,emonth,eyear) {
const url = ‘https://comparyd.herokuapp.com/cmp_json?area=‘+area+’&city=‘+city+’&startdate=‘+sdate+’&startmonth=‘+smonth+’&startyear=‘+syear+’&starthour=06&startminute=30&enddate=‘+edate+’&endmonth=‘+emonth+’&endyear=‘+eyear+’&endhour=06&endminute=30’;
console.log(“hello”);
var x = fetch(url, {method: ‘get’})
.then( function (response)
{
console.log(“ayush:”+response.status);
return response.json();
})
.then(json=>json)
. catch(function (err)
{
console.log(“Retrying as this error came:”+err);
});
console.log(‘world’);
return x;
}
Thanks in advance