import {
  FETCHING_RETURN_REQUESTS,
  RETURN_REQUESTS_SUCCESS,
  RETURN_REQUESTS_FAILURE,
}
  from '../actions/types';

const initialState = {};

const returnRequests = (state = initialState, action) => {
  switch (action.type) {
    case FETCHING_RETURN_REQUESTS: {
      return {
        ...state,
        isFetchingReturnRequests: true,
        returnRequests: null,
        returnRequestsError: null,
      };
    }
    case RETURN_REQUESTS_SUCCESS: {
      return {
        ...state,
        isFetchingReturnRequests: false,
        returnRequests: action.returnRequests,
        returnRequestsError: null,
      };
    }
    case RETURN_REQUESTS_FAILURE: {
      return {
        ...state,
        isFetchingReturnRequests: false,
        returnRequestsError: action.error,
      };
    }
    default: {
      return state;
    }
  }
};

export default returnRequests;


@@ -84,16 +84,109 @@
 AILURE,%0A
+  HANDLING_RETURN_REQUEST,%0A  HANDLE_RETURN_REQUEST_SUCCESS,%0A  HANDLE_RETURN_REQUEST_FAILURE,%0A
 %7D%0A  from
@@ -878,24 +878,706 @@
    %7D;%0A    %7D%0A
+    case HANDLING_RETURN_REQUEST: %7B%0A      return %7B%0A        ...state,%0A        isHandlingReturnRequest: true,%0A      %7D;%0A    %7D%0A    case HANDLE_RETURN_REQUEST_SUCCESS: %7B%0A      return %7B%0A        ...state,%0A        returnRequests: %5B...state.returnRequests.slice(0, action.index),%0A          %7B ...state.returnRequests%5Baction.index%5D, status: action.status.split(' ')%5B1%5D %7D,%0A          ...state.returnRequests.slice(action.index + 1)%5D,%0A        isHandlingReturnRequest: false,%0A      %7D;%0A    %7D%0A    case HANDLE_RETURN_REQUEST_FAILURE: %7B%0A      Materialize.toast(%60Failed to handle request. $%7Baction.error%7D%60, 2000);%0A      return %7B%0A        ...state,%0A        isHandlingReturnRequest: false,%0A      %7D;%0A    %7D%0A
     default:

Add reducer for handling return request