contactUsReducer.js
665 Bytes
import { CONTACT_US_SUBMIT_FAIL, CONTACT_US_SUBMIT_REQUEST, CONTACT_US_SUBMIT_SUCCESS } from "../constants/contactUsConstants";
export const contactUsReducer = (state = { contactUs: null }, action) => {
switch (action.type) {
case CONTACT_US_SUBMIT_REQUEST:
return {
loading: true,
success: false
};
case CONTACT_US_SUBMIT_SUCCESS:
return {
loading: false,
success: true,
referral: action.payload
};
case CONTACT_US_SUBMIT_FAIL:
return {
loading: false,
success: false,
error: action.payload.error.message
};
default:
return state;
}
};