Skip to content

Commit

Permalink
Merge pull request #1119 from flexion/962_clear_form_validation_cancel
Browse files Browse the repository at this point in the history
962 Clear Form and Validation on Cancel
  • Loading branch information
wbyoko authored Mar 15, 2019
2 parents d987290 + f2c1e9d commit 368c398
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions web-client/src/presenter/actions/clearUsersAction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { state } from 'cerebral';

/**
* resets the state.users which is used throughout the app for storing list of users values
*
* @param {Object} providers the providers object
* @param {Object} providers.store the cerebral store object used for clearing the users
*/
export const clearUsersAction = ({ store }) => {
store.set(state.users, []);
};
2 changes: 2 additions & 0 deletions web-client/src/presenter/sequences/createWorkItemSequence.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { unsetFormSubmittingAction } from '../actions/unsetFormSubmittingAction'
import { validateInitialWorkItemMessageAction } from '../actions/validateInitialWorkItemMessageAction';
import { setValidationErrorsAction } from '../actions/setValidationErrorsAction';
import { clearFormAction } from '../actions/clearFormAction';
import { clearUsersAction } from '../actions/clearUsersAction';

export const createWorkItemSequence = [
clearAlertsAction,
Expand All @@ -24,6 +25,7 @@ export const createWorkItemSequence = [
success: [stopShowValidationAction, setAlertSuccessAction],
},
clearFormAction,
clearUsersAction,
clearModalAction,
refreshCaseAction,
unsetFormSubmittingAction,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { clearModalAction } from '../actions/clearModalAction';
import { stopShowValidationAction } from '../actions/stopShowValidationAction';
import { clearAlertsAction } from '../actions/clearAlertsAction';
import { clearFormAction } from '../actions/clearFormAction';
import { clearUsersAction } from '../actions/clearUsersAction';

export const dismissCreateMessageModalSequence = [
stopShowValidationAction,
clearFormAction,
clearUsersAction,
clearAlertsAction,
clearModalAction,
];

0 comments on commit 368c398

Please sign in to comment.