This commit is contained in:
James Barnsley
2017-10-31 08:36:32 +13:00
parent 9179cbcd93
commit d5752e1bac

View File

@ -34,13 +34,13 @@ const SpotifyMiddleware = (function(){
break
case 'SPOTIFY_AUTHORIZATION_GRANTED':
ReactGA.event({ category: 'Spotify', action: 'Authorization granted' })
ReactGA.event({ category: 'Spotify', action: 'Authorization granted' });
// Flush out the previous user's library
store.dispatch(spotifyActions.flushLibrary());
next(action)
break
next(action);
break;
case 'SPOTIFY_AUTHORIZATION_REVOKED':
var label = null
@ -51,7 +51,7 @@ const SpotifyMiddleware = (function(){
next(action)
// Now dispatch a getMe to get the backend-provided user
store.dispatch(spotifyActions.getMe())
store.dispatch(spotifyActions.getMe());
// Flush out the previous user's library
store.dispatch(spotifyActions.flushLibrary());
@ -404,15 +404,16 @@ const SpotifyMiddleware = (function(){
// We've loaded 'me' and we are Anonymous currently
if (action.data && store.getState().pusher.username == 'Anonymous'){
if (action.data.display_name !== null){
var name = action.data.display_name
var name = action.data.display_name;
} else {
var name = action.data.id
var name = action.data.id;
}
// Use 'me' name as my Pusher username
store.dispatch(pusherActions.setUsername(name))
store.dispatch(pusherActions.setUsername(name));
}
ReactGA.event({ category: 'Spotify', action: 'Authorization verified', label: action.data.id })
ReactGA.set({userId: action.data.id});
ReactGA.event({category: 'Spotify', action: 'Authorization verified', label: action.data.id});
store.dispatch({
type: 'USER_LOADED',
@ -420,7 +421,7 @@ const SpotifyMiddleware = (function(){
user: action.data
})
next(action)
next(action);
break;
// This action is irrelevant to us, pass it on to the next middleware