diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/models/contact.js | 3 | ||||
-rw-r--r-- | src/store/addressbooks.js | 2 | ||||
-rw-r--r-- | src/store/contacts.js | 6 |
3 files changed, 6 insertions, 5 deletions
diff --git a/src/models/contact.js b/src/models/contact.js index f19ce260..4edaff42 100644 --- a/src/models/contact.js +++ b/src/models/contact.js @@ -30,10 +30,9 @@ export default class Contact { * * @param {string} vcard the vcard data as string with proper new lines * @param {object} addressbook the addressbook which the contat belongs to - * @param {string} [etag=''] the current etag of the contact * @memberof Contact */ - constructor(vcard, addressbook, etag = '') { + constructor(vcard, addressbook) { if (typeof vcard !== 'string' || vcard.length === 0) { throw new Error('Invalid vCard') } diff --git a/src/store/addressbooks.js b/src/store/addressbooks.js index 15287c9b..3c745c95 100644 --- a/src/store/addressbooks.js +++ b/src/store/addressbooks.js @@ -312,7 +312,7 @@ const actions = { // We don't want to lose the url information // so we need to parse one by one const contacts = response.map(item => { - let contact = new Contact(item.data, addressbook, item.etag) + let contact = new Contact(item.data, addressbook) Vue.set(contact, 'dav', item) return contact }) diff --git a/src/store/contacts.js b/src/store/contacts.js index a6511e5d..e2220e91 100644 --- a/src/store/contacts.js +++ b/src/store/contacts.js @@ -279,6 +279,8 @@ const actions = { .then((response) => { // wrong etag, we most likely have a conflict if (response.status === 412) { + // saving the new etag so that the user can manually + // trigger a fetchCompleteData without any further errors contact.conflict = response.xhr.getResponseHeader('etag') } else { // all clear, let's update the store @@ -297,7 +299,7 @@ const actions = { * @param {Object} context the store mutations * @param {Object} data destructuring object * @param {Contact} data.contact the contact to fetch - * @param {string} data.etag the contact etag + * @param {string} data.etag the contact etag to override in case of conflict * @returns {Promise} */ async fetchFullContact(context, { contact, etag = '' }) { @@ -306,7 +308,7 @@ const actions = { } return contact.dav.fetchCompleteData() .then((response) => { - let newContact = new Contact(contact.dav.data, contact.addressbook, contact.dav.etag) + let newContact = new Contact(contact.dav.data, contact.addressbook) context.commit('updateContact', newContact) }) .catch((error) => { throw error }) |