Flow, coding style

This commit is contained in:
Lyubo Marinov 2017-10-12 14:59:11 -05:00
parent 122be9e0e0
commit da03b49754
1 changed files with 20 additions and 16 deletions

View File

@ -1,3 +1,5 @@
// @flow
import { equals, set, ReducerRegistry } from '../redux'; import { equals, set, ReducerRegistry } from '../redux';
import { SET_CALL_OVERLAY_VISIBLE, SET_JWT } from './actionTypes'; import { SET_CALL_OVERLAY_VISIBLE, SET_JWT } from './actionTypes';
@ -7,6 +9,7 @@ import { SET_CALL_OVERLAY_VISIBLE, SET_JWT } from './actionTypes';
* *
* @private * @private
* @type {{ * @type {{
* callOverlayVisible: ?boolean
* isGuest: boolean * isGuest: boolean
* }} * }}
*/ */
@ -38,22 +41,23 @@ const _INITIAL_STATE = {
* specified {@code action}. * specified {@code action}.
*/ */
ReducerRegistry.register( ReducerRegistry.register(
'features/base/jwt', (state = _INITIAL_STATE, action) => { 'features/base/jwt',
switch (action.type) { (state = _INITIAL_STATE, action) => {
case SET_CALL_OVERLAY_VISIBLE: switch (action.type) {
return set(state, 'callOverlayVisible', action.callOverlayVisible); case SET_CALL_OVERLAY_VISIBLE:
return set(state, 'callOverlayVisible', action.callOverlayVisible);
case SET_JWT: { case SET_JWT: {
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
const { type, ...payload } = action; const { type, ...payload } = action;
const nextState = { const nextState = {
..._INITIAL_STATE, ..._INITIAL_STATE,
...payload ...payload
}; };
return equals(state, nextState) ? state : nextState; return equals(state, nextState) ? state : nextState;
} }
} }
return state; return state;
}); });