diff options
author | Jessica <jessica@Absolventas-MacBook-Pro.local> | 2018-09-21 16:00:16 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-09-25 14:52:43 +0200 |
commit | 7f0021d4e0a5a07ea758ec30cc5bea146d8deb81 (patch) | |
tree | 741aec4948b76a25bd84bd2cdb04cbb67b418469 /src | |
parent | 7693611495b1396626e803feb8193691e2d72786 (diff) |
added dav lib for rename, delete and enable addressbook actions.
Diffstat (limited to 'src')
-rw-r--r-- | src/store/addressbooks.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/store/addressbooks.js b/src/store/addressbooks.js index 9197ee44..ad0f2745 100644 --- a/src/store/addressbooks.js +++ b/src/store/addressbooks.js @@ -244,7 +244,8 @@ const actions = { * @param {Object} addressbook */ deleteAddressbook(context, addressbook) { - context.commit('deleteAddressbook', addressbook) + return addressbook.dav.delete().then((response) => context.commit('deleteAddressbook', addressbook)) + .catch((error) => { throw error }) }, /** @@ -253,7 +254,9 @@ const actions = { * @param {Object} addressbook */ toggleAddressbookEnabled(context, addressbook) { - context.commit('toggleAddressbookEnabled', addressbook) + addressbook.dav.enabled = !addressbook.dav.enabled + return addressbook.dav.update().then((response) => context.commit('toggleAddressbookEnabled', addressbook)) + .catch((error) => { throw error }) }, /** @@ -263,8 +266,8 @@ const actions = { * @param {String} data.newName */ renameAddressbook(context, { addressbook, newName }) { - return addressbook.dav.displayname(newName) - .then((response) => context.commit('renameAddressbook', { addressbook, newName })) + addressbook.dav.displayname = newName + return addressbook.dav.update().then((response) => context.commit('renameAddressbook', { addressbook, newName })) .catch((error) => { throw error }) }, @@ -293,7 +296,7 @@ const actions = { context.commit('sortContacts') return contacts }) - .catch((error) => { + .catch((error) => { // unrecoverable error, if no contacts were loaded, // remove the addressbook // TODO: create a failed addressbook state and show that there was an issue? |