Fix:Set server settings after user logs in

This commit is contained in:
advplyr 2022-07-19 16:40:50 -05:00
parent db1d6da491
commit 7188089f63
4 changed files with 4 additions and 12 deletions

View file

@ -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))) {