diff --git a/src/actions/RecordsActions.js b/src/actions/RecordsActions.js index 497a6c7..758b3f9 100644 --- a/src/actions/RecordsActions.js +++ b/src/actions/RecordsActions.js @@ -196,7 +196,7 @@ export function loadAllowedRejectReason() { dispatch(loadAllowedRejectReasonSuccess(response.data)); }) .catch((error) => { - dispatch(loadAllowedRejectReasonError(error)); + dispatch(loadAllowedRejectReasonError(error.response.data)); }); }; } diff --git a/src/components/button/RejectButton.jsx b/src/components/button/RejectButton.jsx index b331b55..816659f 100644 --- a/src/components/button/RejectButton.jsx +++ b/src/components/button/RejectButton.jsx @@ -12,7 +12,7 @@ const RejectButton = ({ variant = "danger", size = "sm", disabled = true, - onClick = () => {}, + onClick = (rejectReason) => {}, }) => { const { i18n } = useI18n(); const dispatch = useDispatch(); @@ -39,37 +39,38 @@ const RejectButton = ({ {children} ) : ( - )} - - - - {i18n("reject-dialog-title")} - - -
- - - -
-
- - - - -
+ {isAllowedRejectReason && ( + + + {i18n("reject-dialog-title")} + + +
+ + + +
+
+ + + + +
+ )} ); }; diff --git a/src/components/record/RecordController.jsx b/src/components/record/RecordController.jsx index ee10db3..97fec71 100644 --- a/src/components/record/RecordController.jsx +++ b/src/components/record/RecordController.jsx @@ -138,9 +138,9 @@ class RecordController extends React.Component { }); }; - _onReject = (reason) => { + _onReject = (rejectionReason) => { this._handlePhaseChange(RECORD_PHASE.REJECTED, () => { - this._handleRejectReason(reason, () => { + this._handleRejectReason(rejectionReason, () => { this.props.updateRecord(this.state.record, this.props.currentUser); this._transitionToRecords(); }); diff --git a/src/reducers/RecordsReducer.js b/src/reducers/RecordsReducer.js index c53b8f9..041fdb8 100644 --- a/src/reducers/RecordsReducer.js +++ b/src/reducers/RecordsReducer.js @@ -74,7 +74,7 @@ export default function (state = initialState, action) { ...state, isAllowedRejectReason: { status: ACTION_STATUS.PENDING, - data: state.isAllowedRejectReason, + data: action.isAllowedRejectReason, error: "", }, };