Created
June 9, 2017 21:56
-
-
Save matthieu-D/f53aa602c8e67582541924a10518bdfd 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
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