summaryrefslogtreecommitdiffstats
path: root/src/views
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-09-21 11:38:51 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-09-25 14:52:43 +0200
commitcdc9b5c36ac74cbaf788196cfcdb289ba29eabc8 (patch)
tree614219ba8fe5c832bf770f09daf0acb135e4773c /src/views
parentcffaf4a6a252f3f56424dc1c6f9f8d265be3e813 (diff)
Removed unwanted config, better error handling and preload contacts
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'src/views')
-rw-r--r--src/views/Contacts.vue19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/views/Contacts.vue b/src/views/Contacts.vue
index 13d86b09..f6117b49 100644
--- a/src/views/Contacts.vue
+++ b/src/views/Contacts.vue
@@ -26,14 +26,14 @@
<!-- new-contact-button + navigation + settings -->
<app-navigation :menu="menu">
<!-- settings -->
- <settings-section slot="settings-content" v-if="!loading" />
+ <settings-section v-if="!loading" slot="settings-content" />
</app-navigation>
<!-- main content -->
<div id="app-content">
<div id="app-content-wrapper">
<!-- loading -->
- <import-screen v-if="importState.stage != 'default'" />
+ <import-screen v-if="importState.stage !== 'default'" />
<template v-else>
<!-- contacts list -->
<content-list :list="contactsList" :contacts="contacts" :loading="loading" />
@@ -202,12 +202,14 @@ export default {
console.debug('Connected to dav!', client)
this.$store.dispatch('getAddressbooks')
.then(() => {
- Promise.all(this.addressbooks.map(async addressbook => {
- await this.$store.dispatch('getContactsFromAddressBook', { addressbook })
- })).then(() => {
- this.loading = false
- this.selectFirstContactIfNone()
- })
+ // wait for all addressbooks to have fetch their contacts
+ Promise.all(this.addressbooks.map(addressbook => this.$store.dispatch('getContactsFromAddressBook', { addressbook })))
+ .then(results => {
+ this.loading = false
+ this.selectFirstContactIfNone()
+ })
+ // no need for a catch, the action does not throw
+ // and the error is handled there
})
// check local storage for orderKey
if (localStorage.getItem('orderKey')) {
@@ -276,7 +278,6 @@ export default {
selectedContact: Object.values(this.contactsList)[0].key
}
})
- document.querySelector('.app-content-list-item.active').scrollIntoView()
}
}
}