Repository URL to install this package:
|
Version:
1.5.2-rc.1 ▾
|
import { ActionTypes } from '../actions/intercomActions';
import { initialState } from '../index';
export const reducer = (state = initialState, action) => {
switch (action.type) {
case ActionTypes.BOOT: {
return {
...state,
booted: true,
};
}
default:
return state;
}
};
/**
* Creates a reducer that can be used with [`combineReducer`](http://redux.js.org/docs/api/combineReducers.html)
* @param {Object} options Reducer options
* @param {string} options.domain For mounting this reducer under a different key in redux. Default: `intercom`.
*
* @example
* // reducer.js
* import { createReducer as createintercomReducer } from '@doodle/intercom-connector';
* import { combineReducers } from 'redux';
*
* export default combineReducers({
* ...createintercomReducer(), // providing the reducer under the `domain` key
* })
*/
export const createReducer = (options = {}) => ({
[options.domain || 'intercom']: reducer,
});