Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthieu-D/f53aa602c8e67582541924a10518bdfd to your computer and use it in GitHub Desktop.
Save matthieu-D/f53aa602c8e67582541924a10518bdfd to your computer and use it in GitHub Desktop.
addTask() {
let id = this.generateId();
let addModal = this.modalCtrl.create(TasksCreatePage, { 'id': id });
let self = this;
addModal.onDidDismiss(item => {
if (item) {
item.userId = AWS.config.credentials.identityId;
item.created = (new Date().getTime() / 1000);
self.db.getDocumentClient().put({
'TableName': self.taskTable,
'Item': item,
'ConditionExpression': 'attribute_not_exists(id)'
}, function(err, data) {
if (err) { console.log(err); }
self.refreshTasks();
});
}
})
addModal.present();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment