web-installer/src/redux/reducers/channelsReducer.js
// Reducers to add and remove telegram configurations from global state
Reducers to add and remove telegram configurations from global state
Reducers to add and remove telegram configurations from global state
function telegramsById(state = {}, action) {
  let parsed = {};
  switch (action.type) {
    case ADD_TELEGRAM:
      return {
        ...state,
        [action.payload.id]: action.payload,
      };
    case REMOVE_TELEGRAM:
      return _.omit(state, action.payload.id);
    case ADD_TELEGRAM_CHANNEL:
      parsed = JSON.parse(JSON.stringify(action.payload));
      return {
        ...state,
        [action.payload.id]: parsed,
      };
    case REMOVE_TELEGRAM_CHANNEL:
      parsed = JSON.parse(JSON.stringify(action.payload));
      return {
        ...state,
        [action.payload.id]: parsed,
      };
    default:
      return state;
  }
}
function telegramsById ( state = { } , action ) { let parsed = { } ; switch ( action . type ) { case ADD_TELEGRAM : return { ... state , [ action . payload . id ] : action . payload , } ; case REMOVE_TELEGRAM : return _ . omit ( state , action . payload . id ) ; case ADD_TELEGRAM_CHANNEL : parsed = JSON . parse ( JSON . stringify ( action . payload ) ) ; return { ... state , [ action . payload . id ] : parsed , } ; case REMOVE_TELEGRAM_CHANNEL : parsed = JSON . parse ( JSON . stringify ( action . payload ) ) ; return { ... state , [ action . payload . id ] : parsed , } ; default : return state ; } }
Reducers to add and remove telegram configurations from global state
Reducers to add and remove telegram configurations from global state