JSFiddle - React, Tailwind, and code Playground
by KevinGabbert
JavaScript
getBooksWithPromise(): Promise<Book[]> {
return this.http.get("https://spreadsheets.google.com/feeds/cells/1uOyKlAhppYBboW3wrXK4UgEHxcporEgwCgqSpwKM8hk/1/public/full?alt=json").toPromise()
.then(this.extractData)
.catch(this.handleErrorPromise);
}
private extractData(res: Response) {
alert("hello");
let body = res.json();
var entries = body.feed.entry;
//todo: this should be queried with more of a linq
// or for.. of syntax
var text = entries[0]['content']['$t'];
var i = 0;
for (i = 0; i < 20; i++) {
text += entries[i]['content']['$t'];
}
text = entries[7]['content']['$t'] || false;
alert(text);
return body;
}