caremyway-client/src/reducers/employerReducer.js
2018-01-21 18:20:41 -07:00

48 lines
1.1 KiB
JavaScript

import {
IS_SENDING_EMPLOYER_REQUEST,
SET_EMPLOYER_REQUEST_ERROR,
CLEAR_EMPLOYER_REQUEST_ERROR,
SET_EMPLOYER_REQUEST_SUCCESS,
CLEAR_EMPLOYER_REQUEST_SUCCESS
} from "../constants/employer.constants";
const initialState = {
isSendingEmployerRequest: false,
employerRequestError: "",
employerRequestSuccess: ""
};
function employerReducer(state = initialState, action) {
switch (action.type) {
case IS_SENDING_EMPLOYER_REQUEST:
return {
...state,
isSendingEmployerRequest: action.data
};
case SET_EMPLOYER_REQUEST_ERROR:
return {
...state,
employerRequestError: action.data
};
case CLEAR_EMPLOYER_REQUEST_ERROR:
return {
...state,
employerRequestError: ""
};
case SET_EMPLOYER_REQUEST_SUCCESS:
return {
...state,
employerRequestSuccess: action.data
};
case CLEAR_EMPLOYER_REQUEST_SUCCESS:
return {
...state,
employerRequestSuccess: ""
};
default:
return state;
}
}
export default employerReducer;