Add connection reducer

This commit is contained in:
GHOSCHT 2020-08-10 14:56:13 +02:00
parent 7894511905
commit 5c4b1abbfa
3 changed files with 23 additions and 1 deletions

View 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';

View file

@ -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;
}
};

View file

@ -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;