Created
September 10, 2019 16:02
-
-
Save ikishanoza/1ae8b10a960075fabcf2bf57f08a943f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_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