I am trying to get the data from my API call but using a Promise.
interface SomeType {
status: string;
other?: string; // not used - delete
}
indexStatus(indexName: string): string {
// this.content = {};
const returnedPromise = this.indexStatusCall(indexName)
.then(returnData => {
this.content = returnData;
return returnData;
});
this.content = returnedPromise;
console.log("----this.content: ", returnedPromise);
return returnedPromise[0];
}
indexStatusCall(indexName: string): Promise < SomeType > {
return this.http.fetch('http:API-PATH/indices/' + indexNameReplaced + '?format=json&h=status')
.then(response => response.json())
.then(data => {
return data;
});
}
And here is what the console.log is showing
How can I get to my "status" value?