Add connection reducer
This commit is contained in:
parent
7894511905
commit
5c4b1abbfa
3 changed files with 23 additions and 1 deletions
4
Dashboard/app/renderer/store/actions/actionTypes.js
Normal file
4
Dashboard/app/renderer/store/actions/actionTypes.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
export const SET_CONNECTION_PARAMS = 'SET_CONNECTION_PARAMS';
|
||||
export const CONNECT = 'CONNECT';
|
||||
export const DISCONNECT = 'DISCONNECT';
|
||||
export const SET_CONNECTION_STATUS = 'SET_CONNECTION_STATUS';
|
|
@ -0,0 +1,17 @@
|
|||
import { SET_CONNECTION_STATUS } from '../actions/actionTypes';
|
||||
|
||||
const initialState = false;
|
||||
|
||||
export default (state = initialState, { type, payload }) => {
|
||||
switch (type) {
|
||||
case SET_CONNECTION_STATUS:
|
||||
if (typeof payload === 'boolean') {
|
||||
return payload;
|
||||
} else {
|
||||
return state;
|
||||
}
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
|
@ -1,6 +1,7 @@
|
|||
import { combineReducers } from 'redux';
|
||||
import comConnectionReducer from './comConnectionReducer';
|
||||
import comConnectionStatusReducer from './comConnectionStatusReducer';
|
||||
|
||||
const rootReducer = combineReducers({ comConnectionReducer });
|
||||
const rootReducer = combineReducers({ comConnectionReducer, comConnectionStatusReducer });
|
||||
|
||||
export default rootReducer;
|
||||
|
|
Reference in a new issue