Playlist loader; Logging; Mopidy search

This commit is contained in:
James Barnsley
2016-11-07 18:09:42 +13:00
parent 5aec62a296
commit 757f11a6dd
12 changed files with 334 additions and 204 deletions

View File

@ -5,13 +5,15 @@ const localstorageMiddleware = (function(){
* The actual middleware inteceptor
**/
return store => next => action => {
console.log(action);//, store.getState())
// proceed as normal first
// this way, any reducers and middleware do their thing BEFORE we store our new state
next(action);
// append our state to a global variable. This gives us access to debug the store at any point
window._store = store
console.log(action)
switch( action.type ){
case 'PUSHER_CONNECTED':
@ -48,6 +50,13 @@ const localstorageMiddleware = (function(){
localStorage.setItem('mopidy', JSON.stringify(mopidy));
break;
case 'MOPIDY_URISCHEMES_FILTERED':
var mopidy = JSON.parse( localStorage.getItem('mopidy') );
if( !mopidy ) mopidy = {};
Object.assign( mopidy, { uri_schemes: action.data });
localStorage.setItem('mopidy', JSON.stringify(mopidy));
break;
case 'SPOTIFY_SET_CONFIG':
var spotify = {
country: action.config.country,