Icon simplification; Spotify authorization updates Pusher User, fixes #119
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
var helpers = require('./../../helpers')
|
||||
var spotifyActions = require('./actions')
|
||||
var uiActions = require('../ui/actions')
|
||||
var pusherActions = require('../pusher/actions')
|
||||
|
||||
const SpotifyMiddleware = (function(){
|
||||
|
||||
@ -348,6 +349,22 @@ const SpotifyMiddleware = (function(){
|
||||
});
|
||||
break
|
||||
|
||||
case 'SPOTIFY_ME_LOADED':
|
||||
|
||||
// We've loaded 'me' and we are Anonymous currently
|
||||
if (action.data && store.getState().pusher.username == 'Anonymous'){
|
||||
if (typeof(action.data.display_name) !== 'undefined'){
|
||||
var name = action.data.display_name
|
||||
} else {
|
||||
var name = action.data.id
|
||||
}
|
||||
|
||||
// Use 'me' name as my Pusher username
|
||||
store.dispatch(pusherActions.setUsername(name))
|
||||
}
|
||||
next(action)
|
||||
break;
|
||||
|
||||
// This action is irrelevant to us, pass it on to the next middleware
|
||||
default:
|
||||
return next(action);
|
||||
|
||||
Reference in New Issue
Block a user