Push spotify auth; Fixing MIA authentication

This commit is contained in:
James Barnsley
2016-12-12 09:07:47 +13:00
parent 26b069faa7
commit 5885439e48
18 changed files with 275 additions and 97 deletions

View File

@ -87,7 +87,7 @@ const PusherMiddleware = (function(){
break;
case 'PUSHER_INSTRUCT':
switch( action.action ){
switch( action.message_type ){
case 'query':
makeRequest( action.data )
break
@ -150,6 +150,20 @@ const PusherMiddleware = (function(){
var notification = new notification( title, options );
break;
case 'PUSHER_SEND_AUTHORIZATION':
if( window.confirm('Spotify authorization for user '+action.data.me.id+' received. Do you want to import?') ){
// remove any existing authentication
store.dispatch({ type: 'SPOTIFY_AUTHORIZATION_REVOKED' })
// import our new authentication
store.dispatch({ type: 'SPOTIFY_ME_LOADED', data: action.data.me })
store.dispatch({ type: 'SPOTIFY_AUTHORIZATION_GRANTED', data: action.data.authorization })
}else{
console.log('Authorization ignored')
}
break
// This action is irrelevant to us, pass it on to the next middleware
default:
return next(action);