Skip to content

Commit e42933b

Browse files
committed
[spalenque] - #13144 * add deleteRequest to react core utils
1 parent ba2ecd8 commit e42933b

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

ui-core/ui/source/js/utils/actions.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,30 @@ export const putRequest = (
9191
)
9292
};
9393

94+
export const deleteRequest = (
95+
requestActionCreator,
96+
receiveActionCreator,
97+
endpoint,
98+
payload,
99+
errorHandler
100+
) => params => dispatch => {
101+
let url = URI(endpoint).toString();
102+
dispatch(requestActionCreator(params));
103+
const req = http.delete(url)
104+
.send(payload)
105+
.end(
106+
responseHandler(
107+
dispatch,
108+
json => {
109+
dispatch(receiveActionCreator({
110+
response: json
111+
}));
112+
},
113+
errorHandler
114+
)
115+
)
116+
};
117+
94118
export const clearMessage = createAction('CLEAR_MESSAGE');
95119

96120
export const showMessage = createAction('SHOW_MESSAGE');

0 commit comments

Comments
 (0)