Placeholder for copyuris; Fixing expired tokens

This commit is contained in:
James Barnsley
2016-11-19 08:44:25 +13:00
parent a411d9a800
commit 7f9b92ea17
5 changed files with 32 additions and 19 deletions

View File

@ -9,16 +9,6 @@ export default function reducer(spotify = {}, action){
case 'SPOTIFY_CONNECTED':
return Object.assign({}, spotify, { connected: true, connecting: false });
case 'SPOTIFY_AUTHORIZATION_GRANTED':
return Object.assign({}, spotify, {
authorizing: false,
authorized: true,
authorization: action.data,
access_token: action.data.access_token,
refresh_token: action.data.refresh_token,
token_expiry: action.data.token_expiry
});
case 'PUSHER_SPOTIFY_TOKEN':
if( spotify.authorized ) return spotify;
return Object.assign({}, spotify, {
@ -29,12 +19,24 @@ export default function reducer(spotify = {}, action){
token_expiry: action.data.token_expiry
});
case 'SPOTIFY_AUTHORIZATION_GRANTED':
return Object.assign({}, spotify, {
authorizing: false,
authorized: true,
authorization: action.data,
access_token: action.data.access_token,
refresh_token: action.data.refresh_token,
token_expiry: action.data.token_expiry
});
case 'SPOTIFY_AUTHORIZATION_REVOKED':
return Object.assign({}, spotify, {
authorizing: false,
authorization: false,
authorized: false,
access_token: false,
refresh_token: false,
token_expiry: 0,
me: false
});