diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-09-27 16:07:30 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-09-27 16:07:30 +0200 |
commit | 6fd9a75b9bc3fd61a693336ba91e566321c0f1f3 (patch) | |
tree | 16fa70600b22c1ac4317342560645ed078a87795 /src | |
parent | 309dbc5efd6d87eb89a1b6c99f7b957bcc3e4513 (diff) |
Delete the contacts from the store after an ab deletion
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/store/addressbooks.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/store/addressbooks.js b/src/store/addressbooks.js index 74a47bef..1b17f6be 100644 --- a/src/store/addressbooks.js +++ b/src/store/addressbooks.js @@ -258,7 +258,14 @@ const actions = { * @returns {Promise} */ async deleteAddressbook(context, addressbook) { - return addressbook.dav.delete().then((response) => context.commit('deleteAddressbook', addressbook)) + return addressbook.dav.delete() + .then((response) => { + // delete all the contacts from the store that belong to this addressbook + Object.values(addressbook.contacts) + .forEach(contact => context.commit('deleteContact', contact)) + // then delete the addressbook + context.commit('deleteAddressbook', addressbook) + }) .catch((error) => { throw error }) }, |