Fix authorize race condition by not updating the user on token refresh #4567

This commit is contained in:
advplyr 2025-08-13 08:31:01 -05:00
parent fb3834156b
commit 2c45b28d48
4 changed files with 5 additions and 6 deletions

View file

@ -199,7 +199,7 @@ export default {
} }
} else { } else {
console.error('User has no more accessible libraries') console.error('User has no more accessible libraries')
this.$store.commit('libraries/setCurrentLibrary', null) this.$store.commit('libraries/setCurrentLibrary', { id: null })
} }
} }
}, },

View file

@ -189,7 +189,7 @@ export default {
require('@/plugins/chromecast.js').default(this) require('@/plugins/chromecast.js').default(this)
} }
this.$store.commit('libraries/setCurrentLibrary', userDefaultLibraryId) this.$store.commit('libraries/setCurrentLibrary', { id: userDefaultLibraryId })
this.$store.commit('user/setUser', user) this.$store.commit('user/setUser', user)
// Access token only returned from login, not authorize // Access token only returned from login, not authorize
if (user.accessToken) { if (user.accessToken) {

View file

@ -133,7 +133,7 @@ export const actions = {
commit('setNumUserPlaylists', numUserPlaylists) commit('setNumUserPlaylists', numUserPlaylists)
commit('scanners/setCustomMetadataProviders', customMetadataProviders, { root: true }) commit('scanners/setCustomMetadataProviders', customMetadataProviders, { root: true })
commit('setCurrentLibrary', libraryId) commit('setCurrentLibrary', { id: libraryId })
return data return data
}) })
.catch((error) => { .catch((error) => {
@ -182,8 +182,8 @@ export const mutations = {
setLibraryIssues(state, val) { setLibraryIssues(state, val) {
state.issues = val state.issues = val
}, },
setCurrentLibrary(state, val) { setCurrentLibrary(state, { id }) {
state.currentLibraryId = val state.currentLibraryId = id
}, },
set(state, libraries) { set(state, libraries) {
state.libraries = libraries state.libraries = libraries

View file

@ -152,7 +152,6 @@ export const actions = {
.$post('/auth/refresh') .$post('/auth/refresh')
.then(async (response) => { .then(async (response) => {
const newAccessToken = response.user.accessToken const newAccessToken = response.user.accessToken
commit('setUser', response.user)
commit('setAccessToken', newAccessToken) commit('setAccessToken', newAccessToken)
// Emit event used to re-authenticate socket in default.vue since $root is not available here // Emit event used to re-authenticate socket in default.vue since $root is not available here
if (this.$eventBus) { if (this.$eventBus) {