webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsActions.js in katello-3.7.0.rc2 vs webpack/scenes/Subscriptions/UpstreamSubscriptions/UpstreamSubscriptionsActions.js in katello-3.7.0
- old
+ new
@@ -1,7 +1,8 @@
import api, { orgId } from '../../../services/api';
import { propsToSnakeCase } from '../../../services/index';
+import { apiError } from '../../../move_to_foreman/common/helpers.js';
import {
UPSTREAM_SUBSCRIPTIONS_REQUEST,
UPSTREAM_SUBSCRIPTIONS_SUCCESS,
UPSTREAM_SUBSCRIPTIONS_FAILURE,
@@ -25,16 +26,11 @@
type: UPSTREAM_SUBSCRIPTIONS_SUCCESS,
response: data,
search: extendedParams.search,
});
})
- .catch((result) => {
- dispatch({
- type: UPSTREAM_SUBSCRIPTIONS_FAILURE,
- result,
- });
- });
+ .catch(result => dispatch(apiError(UPSTREAM_SUBSCRIPTIONS_FAILURE, result)));
};
export const saveUpstreamSubscriptions = upstreamSubscriptions => (dispatch) => {
dispatch({ type: SAVE_UPSTREAM_SUBSCRIPTIONS_REQUEST });
@@ -48,14 +44,9 @@
dispatch({
type: SAVE_UPSTREAM_SUBSCRIPTIONS_SUCCESS,
response: data,
});
})
- .catch((result) => {
- dispatch({
- type: SAVE_UPSTREAM_SUBSCRIPTIONS_FAILURE,
- result,
- });
- });
+ .catch(result => dispatch(apiError(SAVE_UPSTREAM_SUBSCRIPTIONS_FAILURE, result)));
};
export default loadUpstreamSubscriptions;