diff --git a/components/app/SideDrawer.vue b/components/app/SideDrawer.vue
index 9827156b..0a36040d 100644
--- a/components/app/SideDrawer.vue
+++ b/components/app/SideDrawer.vue
@@ -122,11 +122,15 @@ export default {
this.show = false
},
async logout() {
- await this.$axios.$post('/logout').catch((error) => {
- console.error(error)
- })
+ if (this.user) {
+ await this.$axios.$post('/logout').catch((error) => {
+ console.error(error)
+ })
+ }
+
this.$socket.logout()
await this.$db.logout()
+ this.$localStore.removeLastLibraryId()
this.$store.commit('user/logout')
this.$router.push('/connect')
},
diff --git a/components/bookshelf/LazyBookshelf.vue b/components/bookshelf/LazyBookshelf.vue
index 63f4fa6a..85e2dd1e 100644
--- a/components/bookshelf/LazyBookshelf.vue
+++ b/components/bookshelf/LazyBookshelf.vue
@@ -382,7 +382,7 @@ export default {
this.resetEntities()
}
},
- libraryChanged(libid) {
+ libraryChanged() {
if (this.hasFilter) {
this.clearFilter()
} else {
diff --git a/components/modals/LibrariesModal.vue b/components/modals/LibrariesModal.vue
index 1876e030..c7fc936e 100644
--- a/components/modals/LibrariesModal.vue
+++ b/components/modals/LibrariesModal.vue
@@ -51,7 +51,7 @@ export default {
async clickedOption(lib) {
this.show = false
await this.$store.dispatch('libraries/fetch', lib.id)
- this.$eventBus.$emit('library-changed', lib.id)
+ this.$eventBus.$emit('library-changed')
this.$localStore.setLastLibraryId(lib.id)
}
},
diff --git a/layouts/default.vue b/layouts/default.vue
index 4820acff..aef6e2fd 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -170,8 +170,8 @@ export default {
this.inittingLibraries = true
await this.$store.dispatch('libraries/load')
console.log(`[default] initLibraries loaded ${this.currentLibraryId}`)
+ await this.$store.dispatch('libraries/fetch', this.currentLibraryId)
this.$eventBus.$emit('library-changed')
- this.$store.dispatch('libraries/fetch', this.currentLibraryId)
this.inittingLibraries = false
},
async syncLocalMediaProgress() {
diff --git a/pages/account.vue b/pages/account.vue
index 357cf8fa..245e43a0 100644
--- a/pages/account.vue
+++ b/pages/account.vue
@@ -53,11 +53,15 @@ export default {
},
methods: {
async logout() {
- await this.$axios.$post('/logout').catch((error) => {
- console.error(error)
- })
+ if (this.user) {
+ await this.$axios.$post('/logout').catch((error) => {
+ console.error(error)
+ })
+ }
+
this.$socket.logout()
await this.$db.logout()
+ this.$localStore.removeLastLibraryId()
this.$store.commit('user/logout')
this.$router.push('/connect')
}
diff --git a/pages/bookshelf.vue b/pages/bookshelf.vue
index b71048eb..fc0d5478 100644
--- a/pages/bookshelf.vue
+++ b/pages/bookshelf.vue
@@ -4,10 +4,6 @@