diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-09-21 15:49:04 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-09-25 14:52:43 +0200 |
commit | 7693611495b1396626e803feb8193691e2d72786 (patch) | |
tree | 91f2e815c5e68da8247042692f775cf5992ccdad /src | |
parent | cdc9b5c36ac74cbaf788196cfcdb289ba29eabc8 (diff) |
Delete dav handler
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/store/addressbooks.js | 14 | ||||
-rw-r--r-- | src/store/contacts.js | 11 |
2 files changed, 17 insertions, 8 deletions
diff --git a/src/store/addressbooks.js b/src/store/addressbooks.js index 385b68ec..9197ee44 100644 --- a/src/store/addressbooks.js +++ b/src/store/addressbooks.js @@ -207,9 +207,9 @@ const actions = { // get last part of url id: addressbook.url.split('/').slice(-2, -1)[0], displayName: addressbook.displayname, - enabled: addressbook.enabled, + enabled: addressbook.enabled !== false, owner: addressbook.owner, - readOnly: addressbook.readOnly, + readOnly: addressbook.readOnly !== false, url: addressbook.url, dav: addressbook } @@ -280,10 +280,12 @@ const actions = { .then((response) => { // We don't want to lose the url information // so we need to parse one by one - const contacts = response.map(contact => { - let item = parseVcf(contact.data, addressbook)[0] - item.url = contact.url - return item + const contacts = response.map(item => { + let contact = parseVcf(item.data, addressbook)[0] + contact.url = item.url + contact.etag = item.etag + contact.dav = item + return contact }) context.commit('appendContactsToAddressbook', { addressbook, contacts }) context.commit('appendContacts', contacts) diff --git a/src/store/contacts.js b/src/store/contacts.js index 4b92e62f..99f87327 100644 --- a/src/store/contacts.js +++ b/src/store/contacts.js @@ -197,8 +197,15 @@ const actions = { * @param {Contact} contact the contact to delete */ deleteContact(context, contact) { - context.commit('deleteContact', contact) - context.commit('deleteContactFromAddressbook', contact) + contact.dav.delete() + .then((response) => { + context.commit('deleteContact', contact) + context.commit('deleteContactFromAddressbook', contact) + }) + .catch((error) => { + console.error(error) + OC.Notification.showTemporary(t('contacts', 'An error occurred')) + }) }, /** |