Fix set token on page load #4509

This commit is contained in:
advplyr 2025-07-18 16:59:27 -05:00
parent b911a25c57
commit 5b6807892f

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
}) })