Sharing of configuration and other authorizations

This commit is contained in:
James Barnsley
2018-09-30 20:09:12 +13:00
parent 96359e0b42
commit 127a8322d0
26 changed files with 996 additions and 472 deletions

View File

@ -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
}
}

View File

@ -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':

View File

@ -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 })