added dav lib for rename, delete and enable addressbook actions.

This commit is contained in:
Jessica 2018-09-21 16:00:16 +02:00 committed by John Molakvoæ (skjnldsv)
parent 7693611495
commit 7f0021d4e0
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
1 changed files with 8 additions and 5 deletions

View File

@ -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?