+
+
{{ item.icon }}
{{ item.text }}
@@ -24,9 +28,9 @@
@@ -126,6 +130,15 @@ export default {
text: 'Settings',
to: '/settings'
})
+
+ if (this.serverConnectionConfig) {
+ items.push({
+ icon: 'login',
+ text: 'Switch Server/User',
+ action: 'logout'
+ })
+ }
+
return items
},
currentRoutePath() {
@@ -133,11 +146,17 @@ export default {
}
},
methods: {
+ async clickAction(action) {
+ await this.$hapticsImpact()
+ if (action === 'logout') {
+ await this.logout()
+ this.$router.push('/connect')
+ }
+ },
clickBackground() {
this.show = false
},
async logout() {
- await this.$hapticsImpact()
if (this.user) {
await this.$nativeHttp.post('/logout').catch((error) => {
console.error('Failed to logout', error)
@@ -148,7 +167,17 @@ export default {
await this.$db.logout()
this.$localStore.removeLastLibraryId()
this.$store.commit('user/logout')
- this.$router.push('/connect')
+ this.$store.commit('libraries/setCurrentLibrary', null)
+ },
+ async disconnect() {
+ await this.$hapticsImpact()
+ await this.logout()
+
+ if (this.$route.name !== 'bookshelf') {
+ this.$router.replace('/bookshelf')
+ } else {
+ location.reload()
+ }
},
touchstart(e) {
this.touchEvent = new TouchEvent(e)
diff --git a/components/bookshelf/LazyBookshelf.vue b/components/bookshelf/LazyBookshelf.vue
index fad3308d..6ecc2f26 100644
--- a/components/bookshelf/LazyBookshelf.vue
+++ b/components/bookshelf/LazyBookshelf.vue
@@ -332,6 +332,12 @@ export default {
},
async init() {
if (this.isFirstInit) return
+ if (!this.user) {
+ // Offline support not available
+ await this.resetEntities()
+ this.$eventBus.$emit('bookshelf-total-entities', 0)
+ return
+ }
this.localLibraryItems = await this.$db.getLocalLibraryItems(this.currentLibraryMediaType)
console.log('Local library items loaded for lazy bookshelf', this.localLibraryItems.length)
diff --git a/pages/account.vue b/pages/account.vue
index 0abe8a2b..e73b7705 100644
--- a/pages/account.vue
+++ b/pages/account.vue
@@ -4,7 +4,7 @@
- Logoutlogout
+ Switch Server/Userlogout
Report bugs, request features, provide feedback, and contribute on GitHub
@@ -58,6 +58,7 @@ export default {
await this.$db.logout()
this.$localStore.removeLastLibraryId()
this.$store.commit('user/logout')
+ this.$store.commit('libraries/setCurrentLibrary', null)
this.$router.push('/connect')
}
},
diff --git a/pages/bookshelf/authors.vue b/pages/bookshelf/authors.vue
index 8b8202c3..20803418 100644
--- a/pages/bookshelf/authors.vue
+++ b/pages/bookshelf/authors.vue
@@ -26,6 +26,9 @@ export default {
},
methods: {
async init() {
+ if (!this.currentLibraryId) {
+ return
+ }
this.loadedLibraryId = this.currentLibraryId
this.authors = await this.$axios
.$get(`/api/libraries/${this.currentLibraryId}/authors`)