User view

This commit is contained in:
James Barnsley
2016-11-18 15:31:06 +13:00
parent 7389cf7fe9
commit 5ddbc48b80
9 changed files with 203 additions and 3 deletions

View File

@ -174,6 +174,26 @@ export default function reducer(ui = {}, action){
return Object.assign({}, ui, { artist: artist, following_loading: false });
/**
* User
**/
case 'SPOTIFY_USER_LOADED':
if( !action.data ) return Object.assign({}, ui, { user: false })
return Object.assign({}, ui, { user: action.data })
case 'SPOTIFY_USER_PLAYLISTS_LOADED_MORE':
var user = Object.assign({}, ui.user, {
playlists: [ ...ui.user.playlists, ...action.data.items ],
playlists_more: action.data.next
})
return Object.assign({}, ui, { user: user });
case 'USER_FOLLOWING_LOADED':
var user = Object.assign({}, ui.user, { following: action.is_following })
return Object.assign({}, ui, { user: user, following_loading: false });
/**
* Playlists
**/