diff --git a/components/connection/ServerConnectForm.vue b/components/connection/ServerConnectForm.vue index 54fb1abd..a5ad3d4e 100644 --- a/components/connection/ServerConnectForm.vue +++ b/components/connection/ServerConnectForm.vue @@ -285,14 +285,16 @@ export default { var payload = await this.requestServerLogin() this.processing = false if (payload) { - this.setUserAndConnection(payload.user, payload.userDefaultLibraryId) + this.setUserAndConnection(payload) } }, - async setUserAndConnection(user, userDefaultLibraryId) { + async setUserAndConnection({ user, userDefaultLibraryId, serverSettings }) { if (!user) return console.log('Successfully logged in', JSON.stringify(user)) + this.$store.commit('setServerSettings', data.serverSettings) + // Set library - Use last library if set and available fallback to default user library var lastLibraryId = await this.$localStore.getLastLibraryId() if (lastLibraryId && (!user.librariesAccessible.length || user.librariesAccessible.includes(lastLibraryId))) { diff --git a/layouts/default.vue b/layouts/default.vue index 97420d4d..74293b79 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -154,9 +154,6 @@ export default { socketConnectionFailed(err) { this.$toast.error('Socket connection error: ' + err.message) }, - socketInit(data) { - console.log('Socket init', data) - }, async initLibraries() { if (this.inittingLibraries) { return @@ -255,7 +252,6 @@ export default { } }, async mounted() { - this.$socket.on('initialized', this.socketInit) this.$socket.on('user_updated', this.userUpdated) this.$socket.on('user_media_progress_updated', this.userMediaProgressUpdated) @@ -283,7 +279,6 @@ export default { } }, beforeDestroy() { - this.$socket.off('initialized', this.socketInit) this.$socket.off('user_updated', this.userUpdated) this.$socket.off('user_media_progress_updated', this.userMediaProgressUpdated) } diff --git a/pages/bookshelf/index.vue b/pages/bookshelf/index.vue index 513f5f55..f1d73b95 100644 --- a/pages/bookshelf/index.vue +++ b/pages/bookshelf/index.vue @@ -183,12 +183,10 @@ export default { }) }, initListeners() { - // this.$server.on('initialized', this.socketInit) this.$eventBus.$on('library-changed', this.libraryChanged) // this.$eventBus.$on('downloads-loaded', this.downloadsLoaded) }, removeListeners() { - // this.$server.off('initialized', this.socketInit) this.$eventBus.$off('library-changed', this.libraryChanged) // this.$eventBus.$off('downloads-loaded', this.downloadsLoaded) } diff --git a/plugins/server.js b/plugins/server.js index e56f44c1..35c9ebd5 100644 --- a/plugins/server.js +++ b/plugins/server.js @@ -80,9 +80,6 @@ class ServerSocket extends EventEmitter { onInit(data) { console.log('[SOCKET] Initial socket data received', data) - if (data.serverSettings) { - this.$store.commit('setServerSettings', data.serverSettings) - } this.emit('initialized', true) }