fetch(url)
returns a promise, which I'm converting to observable using flatmap. Why is this not working?
Rx.Observable
.from(imgSrc)
.map(url => fetch(url))
.flatmap( res => R.Observable.fromPromise(res))
.subscribe(
function(res) {
console.log(res);
},
function(err){
console.log("Errorororrororororor:"+JSON.stringify(err));
response.status(500).send(
{
"error":err
});
},
function(){
console.log("completed promise!!")
response.status(200).send(
{"data": [{
"id": "testing id",
"url": "https://test.com/1.jpg"
}]
});
}
);