Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import {
- REQUEST_REP_SEARCH,
- SUCCESS_REP_SEARCH,
- RESET_DATA,
- SHOW_ALERT,
- } from '../actions/searchReps';
- const intitalState = {
- showLoading: false,
- repsFound: [],
- showAlert: false,
- };
- export default (state = intitalState, action) => {
- switch (action.type) {
- case SHOW_ALERT: {
- return {
- ...state,
- showLoading: false,
- showAlert: true,
- };
- }
- case RESET_DATA: {
- return {
- ...state,
- showLoading: false,
- repsFound: [],
- showAlert: false,
- };
- }
- case REQUEST_REP_SEARCH: {
- return {
- ...state,
- repsFound: [],
- showLoading: true,
- showAlert: false,
- };
- }
- case SUCCESS_REP_SEARCH:
- return {
- ...state,
- repsFound: action.repsFound,
- showLoading: false,
- showAlert: false,
- };
- default:
- return state;
- }
- };
Add Comment
Please, Sign In to add comment