mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Merge pull request #4590 from advplyr/fix_authorize_race_condition
Fix authorize race condition by not updating the user on token refresh
This commit is contained in:
		
						commit
						311ac7104e
					
				| @ -199,7 +199,7 @@ export default { | ||||
|           } | ||||
|         } else { | ||||
|           console.error('User has no more accessible libraries') | ||||
|           this.$store.commit('libraries/setCurrentLibrary', null) | ||||
|           this.$store.commit('libraries/setCurrentLibrary', { id: null }) | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|  | ||||
| @ -189,7 +189,7 @@ export default { | ||||
|         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) | ||||
|       // Access token only returned from login, not authorize | ||||
|       if (user.accessToken) { | ||||
|  | ||||
| @ -133,7 +133,7 @@ export const actions = { | ||||
|         commit('setNumUserPlaylists', numUserPlaylists) | ||||
|         commit('scanners/setCustomMetadataProviders', customMetadataProviders, { root: true }) | ||||
| 
 | ||||
|         commit('setCurrentLibrary', libraryId) | ||||
|         commit('setCurrentLibrary', { id: libraryId }) | ||||
|         return data | ||||
|       }) | ||||
|       .catch((error) => { | ||||
| @ -182,8 +182,8 @@ export const mutations = { | ||||
|   setLibraryIssues(state, val) { | ||||
|     state.issues = val | ||||
|   }, | ||||
|   setCurrentLibrary(state, val) { | ||||
|     state.currentLibraryId = val | ||||
|   setCurrentLibrary(state, { id }) { | ||||
|     state.currentLibraryId = id | ||||
|   }, | ||||
|   set(state, libraries) { | ||||
|     state.libraries = libraries | ||||
|  | ||||
| @ -152,7 +152,6 @@ export const actions = { | ||||
|       .$post('/auth/refresh') | ||||
|       .then(async (response) => { | ||||
|         const newAccessToken = response.user.accessToken | ||||
|         commit('setUser', response.user) | ||||
|         commit('setAccessToken', newAccessToken) | ||||
|         // Emit event used to re-authenticate socket in default.vue since $root is not available here
 | ||||
|         if (this.$eventBus) { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user