Spotify.access will be checker for full access

This commit is contained in:
James Barnsley
2017-08-04 22:33:49 +12:00
parent c2b8cfb346
commit e1ee57bdad
15 changed files with 100 additions and 92 deletions

View File

@ -83,10 +83,10 @@ const localstorageMiddleware = (function(){
case 'SPOTIFY_AUTHORIZATION_GRANTED':
var spotify = JSON.parse( localStorage.getItem('spotify') );
if( !spotify ) spotify = {};
Object.assign(
spotify,{
authorized: true,
spotify = Object.assign(
{},
(spotify ? spotify : {}),
{
authorization: action.data,
access_token: action.data.access_token,
refresh_token: action.data.refresh_token,
@ -97,16 +97,19 @@ const localstorageMiddleware = (function(){
break;
case 'SPOTIFY_AUTHORIZATION_REVOKED':
console.log('local',action)
var spotify = JSON.parse( localStorage.getItem('spotify') );
if( !spotify ) spotify = {};
Object.assign(
spotify,{
authorized: false,
spotify = Object.assign(
{},
(spotify ? spotify : {}),
{
authorization: false,
access_token: false,
refresh_token: false,
token_expiry: false
}
);
console.log(spotify)
localStorage.setItem('spotify', JSON.stringify(spotify));
break;