Mercurial > xmpp-account-manager
comparison vcard.js @ 30:9ba4f8cc32f1
Display the returned error in the title of the spinner.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 23 Dec 2018 17:15:38 +0100 |
parents | 02b5bceeca64 |
children | e561bdd81777 |
comparison
equal
deleted
inserted
replaced
29:15666446c791 | 30:9ba4f8cc32f1 |
---|---|
59 iq.c('email') | 59 iq.c('email') |
60 .c('text').t(vcard_email.value).up().up(); | 60 .c('text').t(vcard_email.value).up().up(); |
61 if (vcard_bday.value) | 61 if (vcard_bday.value) |
62 iq.c('bday') | 62 iq.c('bday') |
63 .c('date').t(vcard_bday.value).up().up(); | 63 .c('date').t(vcard_bday.value).up().up(); |
64 connection.sendIQ(iq, onVCard4Changed, onVCard4ChangeError.bind(null, 'coucou')); | 64 connection.sendIQ(iq, onVCard4Changed, onVCard4ChangeError); |
65 displaySpinner(spinner_img); | 65 displaySpinner(spinner_img); |
66 } | 66 } |
67 | 67 |
68 vcard_fn.addEventListener('blur', setVCard4); | 68 vcard_fn.addEventListener('blur', setVCard4); |
69 vcard_email.addEventListener('blur', setVCard4); | 69 vcard_email.addEventListener('blur', setVCard4); |
73 { | 73 { |
74 console.log('Successfully set vCard4.') | 74 console.log('Successfully set vCard4.') |
75 spinnerOk(spinner_img); | 75 spinnerOk(spinner_img); |
76 } | 76 } |
77 | 77 |
78 function onVCard4ChangeError(string) | 78 function onVCard4ChangeError(iq) |
79 { | 79 { |
80 console.log('Failed to set vCard4: ' + string); | 80 const [condition, text] = parseErrorIq(iq); |
81 spinnerError(spinner_img); | 81 const string = 'Failed to set vCard4: ' + condition + ': ' + text; |
82 console.log(string); | |
83 spinnerError(spinner_img, string); | |
82 } | 84 } |
83 | 85 |
84 vcard_access.addEventListener('change', function (evt) { | 86 vcard_access.addEventListener('change', function (evt) { |
85 const iq = configurePEPField('urn:xmpp:vcard4', 'pubsub#access_model', evt.target.value); | 87 const iq = configurePEPField('urn:xmpp:vcard4', 'pubsub#access_model', evt.target.value); |
86 connection.sendIQ(iq, onAccessConfigured, onAccessConfigureError.bind(null, 'PubSub configuration failed.')); | 88 connection.sendIQ(iq, onAccessConfigured, onAccessConfigureError.bind(null, 'PubSub configuration failed.')); |