Revamp of settings to contain more granular control of services

This commit is contained in:
James Barnsley
2017-08-04 09:19:19 +12:00
parent 123fe51289
commit c34c187007
17 changed files with 741 additions and 621 deletions

View File

@ -35,6 +35,20 @@ const sendRequest = ( dispatch, getState, params ) => {
})
}
export function connect(){
return (dispatch, getState) => {
dispatch({ type: 'LASTFM_CONNECTING' })
sendRequest(dispatch, getState, 'method=artist.getInfo&artist=')
.then(
response => {
dispatch({ type: 'LASTFM_CONNECTED' })
}
)
}
}
export function getArtist( uri, artist, mbid = false ){
return (dispatch, getState) => {
if( mbid ){

View File

@ -2,6 +2,13 @@
export default function reducer(lastfm = {}, action){
switch (action.type) {
case 'LASTFM_CONNECT':
case 'LASTFM_CONNECTING':
return Object.assign({}, lastfm, { connected: false, connecting: true });
case 'LASTFM_CONNECTED':
return Object.assign({}, lastfm, { connected: true, connecting: false });
default:
return lastfm
}