You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
47 lines
1.1 KiB
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;
|
|
|