import { createStore } from 'redux'; const intitialState = { user: null, categories: null, gateway: { isConnected: false } }; const reducer = (state = intitialState, payload) => { switch (payload.type) { case 'authenticator/updatelocaluserobject': { return { ...state, user: payload.user } } case 'categories/updatecategorylist': { return { ...state, categories: payload.categories } } case 'gateway/connectionstatus': { return { ...state, gateway: { isConnected: payload.gateway.isConnected } } } default: { return state; } } }; const store = createStore(reducer, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()); export default store;