mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-21 00:59:29 +00:00
Split out network reducer
This commit is contained in:
parent
7762bff2de
commit
2770b8ca56
2 changed files with 16 additions and 16 deletions
|
|
@ -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
14
js/reducers/network.js
Normal 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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue