@@ -3,7 +3,12 @@ import { useDispatch, useSelector } from "react-redux";
3
3
import debounce from "lodash/debounce" ;
4
4
import omit from "lodash/omit" ;
5
5
import withAuthentication from "hoc/withAuthentication" ;
6
- import { setFilter , setIsModalOpen , setModalRole } from "store/actions/roles" ;
6
+ import {
7
+ setFilter ,
8
+ setIsModalOpen ,
9
+ setModalError ,
10
+ setModalRole ,
11
+ } from "store/actions/roles" ;
7
12
import { createRole , deleteRole , updateRole } from "store/thunks/roles" ;
8
13
import {
9
14
getRolesIsModalOpen ,
@@ -48,6 +53,7 @@ const Roles = () => {
48
53
49
54
const onCreateClick = useCallback ( ( ) => {
50
55
setModalOperationType ( "CREATE" ) ;
56
+ dispatch ( setModalError ( null ) ) ;
51
57
// role template with initial values
52
58
dispatch (
53
59
setModalRole ( {
@@ -65,6 +71,7 @@ const Roles = () => {
65
71
const onEditClick = useCallback (
66
72
( role ) => {
67
73
setModalOperationType ( "EDIT" ) ;
74
+ dispatch ( setModalError ( null ) ) ;
68
75
dispatch ( setModalRole ( role ) ) ;
69
76
dispatch ( setIsModalOpen ( true ) ) ;
70
77
} ,
@@ -74,6 +81,7 @@ const Roles = () => {
74
81
const onDeleteClick = useCallback (
75
82
( role ) => {
76
83
setModalOperationType ( "DELETE" ) ;
84
+ dispatch ( setModalError ( null ) ) ;
77
85
dispatch ( setModalRole ( role ) ) ;
78
86
dispatch ( setIsModalOpen ( true ) ) ;
79
87
} ,
0 commit comments