Merge pull request #4510 from advplyr/fix_set_token

Fix set token on page load #4509
This commit is contained in:
advplyr 2025-07-18 17:11:09 -05:00 committed by GitHub
commit 742961e0b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -191,7 +191,10 @@ export default {
this.$store.commit('libraries/setCurrentLibrary', userDefaultLibraryId) this.$store.commit('libraries/setCurrentLibrary', userDefaultLibraryId)
this.$store.commit('user/setUser', user) this.$store.commit('user/setUser', user)
this.$store.commit('user/setAccessToken', user.accessToken) // Access token only returned from login, not authorize
if (user.accessToken) {
this.$store.commit('user/setAccessToken', user.accessToken)
}
this.$store.dispatch('user/loadUserSettings') this.$store.dispatch('user/loadUserSettings')
}, },
@ -225,6 +228,8 @@ export default {
this.processing = true this.processing = true
this.$store.commit('user/setAccessToken', token)
return this.$axios return this.$axios
.$post('/api/authorize', null, { .$post('/api/authorize', null, {
headers: { headers: {
@ -240,6 +245,7 @@ export default {
this.showNewAuthSystemAdminMessage = res.user.type === 'admin' || res.user.type === 'root' this.showNewAuthSystemAdminMessage = res.user.type === 'admin' || res.user.type === 'root'
return false return false
} }
this.setUser(res) this.setUser(res)
return true return true
}) })