Receive authorization modal (instead of alert

This commit is contained in:
James Barnsley
2017-04-15 05:43:29 +12:00
parent 14aca04f8e
commit 46c8288713
8 changed files with 92 additions and 18 deletions

View File

@ -199,6 +199,14 @@ export function refreshingToken(){
}
}
export function importAuthorization(data){
return {
type: 'SPOTIFY_IMPORT_AUTHORIZATION',
user: data.user,
authorization: data.authorization
}
}
/**
* Get current user

View File

@ -46,6 +46,17 @@ export default function reducer(spotify = {}, action){
me: false
})
case 'SPOTIFY_IMPORT_AUTHORIZATION':
return Object.assign({}, spotify, {
authorizing: false,
authorized: true,
authorization: action.authorization,
access_token: action.authorization.access_token,
refresh_token: action.authorization.refresh_token,
token_expiry: action.authorization.token_expiry,
me: action.user
})
case 'SPOTIFY_TOKEN_REFRESHING':
return Object.assign({}, spotify, { refreshing_token: true })