#17 Revisión cuando un contacto ya existe incluirlo en la lista

This commit is contained in:
David Arranz 2020-11-17 10:48:31 +01:00
parent 67afb9734c
commit 040808c4b4

View File

@ -35,7 +35,7 @@ function _createMember(member) {
api.createContact(createContact) api.createContact(createContact)
.then(function (data) { .then(function (data) {
console.debug('API called successfully. Returned data: ' + data); console.debug('API called successfully. Returned data: ' + data);
if (data.id) { if (data && data.id) {
// Se ha dado de alta el contacto porque no existía // Se ha dado de alta el contacto porque no existía
createContact.ID = data.id; createContact.ID = data.id;
} }
@ -116,6 +116,7 @@ function addMember(listId, member) {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
_createMember(member) _createMember(member)
.then(function(contact) { .then(function(contact) {
console.debug('añadir a lista: ' + listId + ' * ' + contact);
return _addMemberToList(contact, listId); return _addMemberToList(contact, listId);
}) })
.then(function() { .then(function() {