Split out network reducer

This commit is contained in:
Jordan Eldredge 2018-04-02 16:49:06 -07:00
parent 7762bff2de
commit 2770b8ca56
2 changed files with 16 additions and 16 deletions

View file

@ -1,9 +1,5 @@
import { combineReducers } from "redux";
import {
SET_AVAILABLE_SKINS,
NETWORK_CONNECTED,
NETWORK_DISCONNECTED
} from "../actionTypes";
import { SET_AVAILABLE_SKINS } from "../actionTypes";
import playlist from "./playlist";
import windows from "./windows";
@ -11,6 +7,7 @@ import media from "./media";
import display from "./display";
import userInput from "./userInput";
import equalizer from "./equalizer";
import network from "./network";
const defaultSettingsState = {
availableSkins: []
@ -25,17 +22,6 @@ const settings = (state = defaultSettingsState, action) => {
}
};
const network = (state = { connected: true }, action) => {
switch (action.type) {
case NETWORK_CONNECTED:
return { ...state, connected: true };
case NETWORK_DISCONNECTED:
return { ...state, connected: false };
default:
return state;
}
};
const reducer = combineReducers({
userInput,
windows,

14
js/reducers/network.js Normal file
View file

@ -0,0 +1,14 @@
import { NETWORK_CONNECTED, NETWORK_DISCONNECTED } from "../actionTypes";
const network = (state = { connected: true }, action) => {
switch (action.type) {
case NETWORK_CONNECTED:
return { ...state, connected: true };
case NETWORK_DISCONNECTED:
return { ...state, connected: false };
default:
return state;
}
};
export default network;