mirror of https://github.com/nextcloud/contacts
added dav lib for rename, delete and enable addressbook actions.
This commit is contained in:
parent
7693611495
commit
7f0021d4e0
|
@ -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?
|
||||
|
|
Loading…
Reference in New Issue