Sharing of configuration and other authorizations
This commit is contained in:
@ -239,10 +239,9 @@ export function tokenChanged(spotify_token){
|
||||
}
|
||||
}
|
||||
|
||||
export function importAuthorization(user, authorization){
|
||||
export function importAuthorization(authorization){
|
||||
return {
|
||||
type: 'SPOTIFY_IMPORT_AUTHORIZATION',
|
||||
user: user,
|
||||
authorization: authorization
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,19 +50,16 @@ const SpotifyMiddleware = (function(){
|
||||
break;
|
||||
|
||||
case 'SPOTIFY_IMPORT_AUTHORIZATION':
|
||||
if (store.getState().ui.allow_reporting){
|
||||
var hashed_username = null
|
||||
if (store.getState().spotify.me){
|
||||
hashed_username = md5(store.getState().spotify.me);
|
||||
ReactGA.set({userId: hashed_username});
|
||||
}
|
||||
ReactGA.event({category: 'Spotify', action: 'Authorization imported', label: hashed_username});
|
||||
}
|
||||
|
||||
// Flush out the previous user's library
|
||||
store.dispatch(spotifyActions.flushLibrary());
|
||||
|
||||
// Pass to reducer
|
||||
next(action);
|
||||
|
||||
// Then get the new user
|
||||
store.dispatch(spotifyActions.getMe());
|
||||
|
||||
break;
|
||||
|
||||
case 'SPOTIFY_RECOMMENDATIONS_LOADED':
|
||||
|
||||
@ -43,8 +43,8 @@ export default function reducer(spotify = {}, action){
|
||||
access_token: action.authorization.access_token,
|
||||
refresh_token: action.authorization.refresh_token,
|
||||
token_expiry: action.authorization.token_expiry,
|
||||
me: action.user
|
||||
})
|
||||
me: false
|
||||
});
|
||||
|
||||
case 'SPOTIFY_TOKEN_REFRESHING':
|
||||
return Object.assign({}, spotify, { refreshing_token: true })
|
||||
|
||||
Reference in New Issue
Block a user