contacts: display an error if adding a contact somehow failed

(currently it would go on an take 'undefined' as the user identifier, leading
to further errors)
This commit is contained in:
Frédéric Péters 2016-02-09 21:39:29 +01:00
parent 0261387a49
commit c95840c2ee
1 changed files with 4 additions and 0 deletions

View File

@ -321,6 +321,10 @@ $(function() {
$(document).on('gadjo:dialog-done', function(ev, data) {
if (ev.target && ev.target.id != 'create-new-contact') return;
if (data.err == 1) {
alert('error: ' + data.data);
return true;
}
var source_type = $('div.source div[data-source-type]').data('source-type');
var source_pk = $('div.source .active[data-source-pk]').data('source-pk');
var selected_user_id = data.data.user_id;