From d5752e1bac602644fd9f5241d2aa489172614778 Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Tue, 31 Oct 2017 08:36:32 +1300 Subject: [PATCH] UserID --- src/js/services/spotify/middleware.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/js/services/spotify/middleware.js b/src/js/services/spotify/middleware.js index bdfe0ac8..2aae8678 100755 --- a/src/js/services/spotify/middleware.js +++ b/src/js/services/spotify/middleware.js @@ -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