Removing spotify connected status - we connect on demand instead

This commit is contained in:
James Barnsley
2018-04-01 11:52:42 +12:00
parent 9ecddcc1b5
commit 407a2d3a10
12 changed files with 22 additions and 129 deletions

View File

@ -59,13 +59,6 @@ export function debugResponse(response){
}
}
export function startServices(){
return {
type: 'CORE_START_SERVICES'
}
}
export function set(data){
return {
type: 'CORE_SET',

View File

@ -91,13 +91,6 @@ const CoreMiddleware = (function(){
console.error(message, description, data);
break;
case 'CORE_START_SERVICES':
store.dispatch(mopidyActions.connect());
store.dispatch(pusherActions.connect());
next(action)
break
case 'PLAY_PLAYLIST':
ReactGA.event({ category: 'Playlist', action: 'Play', label: action.uri })
next(action)

View File

@ -141,7 +141,6 @@ function refreshToken(dispatch, getState){
resolve(response)
},
(xhr, status, error) => {
dispatch({ type: 'SPOTIFY_DISCONNECTED' })
reject({
config: config,
xhr: xhr,
@ -164,7 +163,6 @@ function refreshToken(dispatch, getState){
.then(
(response, status, xhr) => {
if (response.error){
dispatch({ type: 'SPOTIFY_DISCONNECTED' })
reject({
config: config,
xhr: xhr,
@ -186,7 +184,6 @@ function refreshToken(dispatch, getState){
},
(xhr, status, error) => {
dispatch({ type: 'SPOTIFY_DISCONNECTED' })
reject({
config: config,
xhr: xhr,
@ -269,14 +266,12 @@ export function getMe(){
type: 'SPOTIFY_ME_LOADED',
data: response
});
dispatch({ type: 'SPOTIFY_CONNECTED' });
},
error => {
dispatch(coreActions.handleException(
'Could not load your profile',
error
));
dispatch({ type: 'SPOTIFY_DISCONNECTED' });
}
);
}

View File

@ -4,16 +4,6 @@ import * as helpers from '../../helpers'
export default function reducer(spotify = {}, action){
switch (action.type){
case 'SPOTIFY_CONNECT':
case 'SPOTIFY_CONNECTING':
return Object.assign({}, spotify, { connected: false, connecting: true })
case 'SPOTIFY_CONNECTED':
return Object.assign({}, spotify, { connected: true, connecting: false })
case 'SPOTIFY_DISCONNECTED':
return Object.assign({}, spotify, { connected: false, connecting: false })
case 'SPOTIFY_SET':
return Object.assign({},spotify,action.data)
@ -61,7 +51,6 @@ export default function reducer(spotify = {}, action){
case 'SPOTIFY_TOKEN_REFRESHED':
return Object.assign({}, spotify, {
connected: true,
refreshing_token: false,
access_token: action.data.access_token,
token_expiry: action.data.token_expiry
@ -73,9 +62,6 @@ export default function reducer(spotify = {}, action){
token_expiry: action.spotify_token.token_expiry
});
case 'SPOTIFY_DISCONNECTED':
return Object.assign({}, spotify, { connected: false, connecting: false })
case 'SPOTIFY_ME_LOADED':
return Object.assign({}, spotify, { me: action.data })