@@ -24,6 +24,7 @@ import {
24
24
GET_MAPPING ,
25
25
UPDATE_PERMISSIONS_TO_SERVER ,
26
26
ADD_MAPPING_ROLE_PERMISSIONS ,
27
+ DELETE_MAPPING ,
27
28
} from '../actions/types'
28
29
import MappingApi from '../api/MappingApi'
29
30
import { getClient } from '../../../../app/redux/api/base'
@@ -88,10 +89,27 @@ export function* addMapping({ payload }) {
88
89
}
89
90
}
90
91
92
+ export function * deleteMapping ( { payload } ) {
93
+ yield put ( updatePermissionsLoading ( true ) )
94
+ try {
95
+ const mappingApi = yield * newFunction ( )
96
+ const data = yield call ( mappingApi . deleteMapping , payload . data )
97
+ yield put ( getMapping ( { } ) )
98
+ } catch ( e ) {
99
+ yield put ( updatePermissionsLoading ( false ) )
100
+ // yield put(getMappingResponse(null))
101
+ if ( isFourZeroOneError ( e ) ) {
102
+ const jwt = yield select ( ( state ) => state . authReducer . userinfo_jwt )
103
+ yield put ( getAPIAccessToken ( jwt ) )
104
+ }
105
+ }
106
+ }
107
+
91
108
export function * watchGetMapping ( ) {
92
109
yield takeLatest ( GET_MAPPING , fetchMapping )
93
110
yield takeEvery ( UPDATE_PERMISSIONS_TO_SERVER , updateMapping )
94
111
yield takeEvery ( ADD_MAPPING_ROLE_PERMISSIONS , addMapping )
112
+ yield takeEvery ( DELETE_MAPPING , deleteMapping )
95
113
}
96
114
97
115
export default function * rootSaga ( ) {
0 commit comments