Skip to content

Instantly share code, notes, and snippets.

@ikishanoza
Created September 10, 2019 16:02
Show Gist options
  • Save ikishanoza/1ae8b10a960075fabcf2bf57f08a943f to your computer and use it in GitHub Desktop.
Save ikishanoza/1ae8b10a960075fabcf2bf57f08a943f to your computer and use it in GitHub Desktop.
_httpGetMessages() {
this.http.get(this.base_url + 'messages').subscribe( (response: any) => {
console.log('_httpGetMessages', response);
let value: any = {};
response.forEach(element => {
console.log(element);
value._id = element.slug;
this._db_messages.get(value._id, (err, doc) => {
if (err) {
console.log('In Error')
this._db_messages.put(value).then( (result) => {
console.log('result', result);
});
} else {
console.log('In Not Error')
value._rev = doc._rev;
this._db_messages.put(value).then( (result) => {
console.log('result', result);
});
}
});
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment