summaryrefslogtreecommitdiffstats
path: root/src/store
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-11-19 18:51:38 +0100
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-11-19 18:52:50 +0100
commit85c3b1a00ff3261333ad68e816d9535eb10f6c4d (patch)
tree3205faf713e18f6d0f4ef3524e4222b390dd231e /src/store
parentbfa38cba598fb7c3391334b6cd7fa9a7095dfc43 (diff)
JSDoc cleanup and better code comments
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'src/store')
-rw-r--r--src/store/addressbooks.js30
-rw-r--r--src/store/contacts.js2
-rw-r--r--src/store/groups.js6
-rw-r--r--src/store/importState.js12
4 files changed, 28 insertions, 22 deletions
diff --git a/src/store/addressbooks.js b/src/store/addressbooks.js
index 86720f1b..ca965577 100644
--- a/src/store/addressbooks.js
+++ b/src/store/addressbooks.js
@@ -128,7 +128,7 @@ const mutations = {
* @param {Object} context the store mutations
* @param {Object} data destructuring object
* @param {Object} data.addressbook the addressbook to rename
- * @param {String} data.newName the new name of the addressbook
+ * @param {string} data.newName the new name of the addressbook
*/
renameAddressbook(context, { addressbook, newName }) {
addressbook = state.addressbooks.find(search => search.id === addressbook.id)
@@ -188,7 +188,7 @@ const mutations = {
* @param {string} data.user the userId
* @param {string} data.displayName the displayName
* @param {string} data.uri the sharing principalScheme uri
- * @param {Boolean} data.isGroup is this a group ?
+ * @param {boolean} data.isGroup is this a group ?
*/
shareAddressbook(state, { addressbook, user, displayName, uri, isGroup }) {
addressbook = state.addressbooks.find(search => search.id === addressbook.id)
@@ -242,10 +242,11 @@ const actions = {
* Retrieve and commit addressbooks
*
* @param {Object} context the store mutations
- * @returns {Promise<Array>} the addressbooks
+ * @returns {Object[]} the addressbooks
*/
async getAddressbooks(context) {
- let addressbooks = await client.addressBookHomes[0].findAllAddressBooks()
+ let addressbooks = await client.addressBookHomes[0]
+ .findAllAddressBooks()
.then(addressbooks => {
return addressbooks.map(addressbook => {
// formatting addressbooks
@@ -268,7 +269,8 @@ const actions = {
* @returns {Promise}
*/
async appendAddressbook(context, addressbook) {
- return client.addressBookHomes[0].createAddressBookCollection(addressbook.displayName)
+ return client.addressBookHomes[0]
+ .createAddressBookCollection(addressbook.displayName)
.then((response) => {
addressbook = mapDavCollectionToAddressbook(response)
context.commit('addAddressbook', addressbook)
@@ -283,7 +285,8 @@ const actions = {
* @returns {Promise}
*/
async deleteAddressbook(context, addressbook) {
- return addressbook.dav.delete()
+ return addressbook.dav
+ .delete()
.then((response) => {
// delete all the contacts from the store that belong to this addressbook
Object.values(addressbook.contacts)
@@ -302,7 +305,8 @@ const actions = {
*/
async toggleAddressbookEnabled(context, addressbook) {
addressbook.dav.enabled = !addressbook.enabled
- return addressbook.dav.update()
+ return addressbook.dav
+ .update()
.then((response) => {
context.commit('toggleAddressbookEnabled', addressbook)
if (addressbook.enabled && Object.values(addressbook.contacts).length === 0) {
@@ -317,12 +321,13 @@ const actions = {
* Rename a Addressbook
* @param {Object} context the store mutations Current context
* @param {Object} data.addressbook the addressbook to rename
- * @param {String} data.newName the new name of the addressbook
+ * @param {string} data.newName the new name of the addressbook
* @returns {Promise}
*/
async renameAddressbook(context, { addressbook, newName }) {
addressbook.dav.displayname = newName
- return addressbook.dav.update()
+ return addressbook.dav
+ .update()
.then((response) => context.commit('renameAddressbook', { addressbook, newName }))
.catch((error) => { throw error })
},
@@ -336,7 +341,8 @@ const actions = {
* @returns {Promise}
*/
async getContactsFromAddressBook(context, { addressbook }) {
- return addressbook.dav.findAllAndFilterBySimpleProperties(['EMAIL', 'UID', 'CATEGORIES', 'FN', 'ORG', 'N'])
+ return addressbook.dav
+ .findAllAndFilterBySimpleProperties(['EMAIL', 'UID', 'CATEGORIES', 'FN', 'ORG', 'N'])
.then((response) => {
// We don't want to lose the url information
// so we need to parse one by one
@@ -428,7 +434,7 @@ const actions = {
* @param {Object} data destructuring object
* @param {Object} data.addressbook the addressbook
* @param {string} data.uri the sharee uri
- * @param {Boolean} data.writeable the sharee permission
+ * @param {boolean} data.writeable the sharee permission
*/
async toggleShareeWritable(context, { addressbook, uri, writeable }) {
try {
@@ -447,7 +453,7 @@ const actions = {
* @param {string} data.user the userId
* @param {string} data.displayName the displayName
* @param {string} data.uri the sharing principalScheme uri
- * @param {Boolean} data.isGroup is this a group ?
+ * @param {boolean} data.isGroup is this a group ?
*/
async shareAddressbook(context, { addressbook, user, displayName, uri, isGroup }) {
// Share addressbook with entered group or user
diff --git a/src/store/contacts.js b/src/store/contacts.js
index cc06753d..8aaa2079 100644
--- a/src/store/contacts.js
+++ b/src/store/contacts.js
@@ -245,7 +245,7 @@ const actions = {
* @param {Object} context the store mutations
* @param {Object} data destructuring object
* @param {Contact} data.contact the contact to delete
- * @param {Boolean} [data.dav=true] trigger a dav deletion
+ * @param {boolean} [data.dav=true] trigger a dav deletion
*/
async deleteContact(context, { contact, dav = true }) {
// only local delete if the contact doesn't exists on the server
diff --git a/src/store/groups.js b/src/store/groups.js
index 1f92b5dd..e6cfd4e1 100644
--- a/src/store/groups.js
+++ b/src/store/groups.js
@@ -80,7 +80,7 @@ const mutations = {
*
* @param {Object} state the store data
* @param {Object} data destructuring object
- * @param {String} data.groupName the name of the group
+ * @param {string} data.groupName the name of the group
* @param {Contact} data.contact the contact
*/
removeContactToGroup(state, { groupName, contact }) {
@@ -103,7 +103,7 @@ const actions = {
*
* @param {Object} context the store mutations
* @param {Object} data destructuring object
- * @param {String} data.groupName the name of the group
+ * @param {string} data.groupName the name of the group
* @param {Contact} data.contact the contact
*/
addContactToGroup(context, { groupName, contact }) {
@@ -115,7 +115,7 @@ const actions = {
*
* @param {Object} context the store mutations
* @param {Object} data destructuring object
- * @param {String} data.groupName the name of the group
+ * @param {string} data.groupName the name of the group
* @param {Contact} data.contact the contact
*/
removeContactToGroup(context, { groupName, contact }) {
diff --git a/src/store/importState.js b/src/store/importState.js
index 871fa15b..98bb39a8 100644
--- a/src/store/importState.js
+++ b/src/store/importState.js
@@ -53,7 +53,7 @@ const mutations = {
* Set the total number of contacts
*
* @param {Object} state the store data
- * @param {String} total the total number of contacts to import
+ * @param {string} total the total number of contacts to import
*/
setTotal(state, total) {
state.importState.total = total
@@ -63,7 +63,7 @@ const mutations = {
* Set the address book name
*
* @param {Object} state the store data
- * @param {String} addressbook the name of the address book to import into
+ * @param {string} addressbook the name of the address book to import into
*/
setAddressbook(state, addressbook) {
state.importState.addressbook = addressbook
@@ -73,7 +73,7 @@ const mutations = {
* Change stage to the indicated one
*
* @param {Object} state the store data
- * @param {String} stage the name of the stage ('default', 'importing', 'parsing')
+ * @param {string} stage the name of the stage ('default', 'importing', 'parsing')
*/
changeStage(state, stage) {
state.importState.stage = stage
@@ -118,7 +118,7 @@ const actions = {
* Set the total number of contacts
*
* @param {Object} context the store mutations
- * @param {String} total the total number of contacts to import
+ * @param {string} total the total number of contacts to import
*/
setTotal(context, total) {
context.commit('setTotal', total)
@@ -128,7 +128,7 @@ const actions = {
* Set the address book name
*
* @param {Object} context the store mutations
- * @param {String} addressbook the name of the address book to import into
+ * @param {string} addressbook the name of the address book to import into
*/
setAddressbook(context, addressbook) {
context.commit('setAddressbook', addressbook)
@@ -139,7 +139,7 @@ const actions = {
* and reset if the parsing starts
*
* @param {Object} context the store mutations
- * @param {String} stage the name of the stage ('default', 'importing', 'parsing')
+ * @param {string} stage the name of the stage ('default', 'importing', 'parsing')
*/
changeStage(context, stage) {
context.commit('changeStage', stage)