mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Fixed the extraction of ServerApiError. (#86732)
This commit is contained in:
parent
8527b6cbe3
commit
128a772ee3
2 changed files with 14 additions and 12 deletions
|
@ -179,7 +179,9 @@ describe('middleware', () => {
|
|||
const service = createTrustedAppsServiceMock();
|
||||
const { store, spyMiddleware } = createStoreSetup(service);
|
||||
|
||||
service.getTrustedAppsList.mockRejectedValue(createServerApiError('Internal Server Error'));
|
||||
service.getTrustedAppsList.mockRejectedValue({
|
||||
body: createServerApiError('Internal Server Error'),
|
||||
});
|
||||
|
||||
store.dispatch(createUserChangedUrlAction('/trusted_apps', '?page_index=2&page_size=50'));
|
||||
|
||||
|
@ -315,7 +317,7 @@ describe('middleware', () => {
|
|||
const { store, spyMiddleware } = createStoreSetup(service);
|
||||
|
||||
service.getTrustedAppsList.mockResolvedValue(getTrustedAppsListResponse);
|
||||
service.deleteTrustedApp.mockRejectedValue(notFoundError);
|
||||
service.deleteTrustedApp.mockRejectedValue({ body: notFoundError });
|
||||
|
||||
store.dispatch(createUserChangedUrlAction('/trusted_apps'));
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ const refreshListIfNeeded = async (
|
|||
store.dispatch(
|
||||
createTrustedAppsListResourceStateChangedAction({
|
||||
type: 'FailedResourceState',
|
||||
error,
|
||||
error: error.body,
|
||||
lastLoadedState: getLastLoadedListResourceState(store.getState()),
|
||||
})
|
||||
);
|
||||
|
@ -103,13 +103,6 @@ const refreshListIfNeeded = async (
|
|||
}
|
||||
};
|
||||
|
||||
const createTrustedAppDeletionSubmissionResourceStateChanged = (
|
||||
newState: Immutable<AsyncResourceState>
|
||||
): Immutable<TrustedAppDeletionSubmissionResourceStateChanged> => ({
|
||||
type: 'trustedAppDeletionSubmissionResourceStateChanged',
|
||||
payload: { newState },
|
||||
});
|
||||
|
||||
const updateCreationDialogIfNeeded = (
|
||||
store: ImmutableMiddlewareAPI<TrustedAppsListPageState, AppAction>
|
||||
) => {
|
||||
|
@ -167,7 +160,7 @@ const submitCreationIfNeeded = async (
|
|||
store.dispatch(
|
||||
createTrustedAppCreationSubmissionResourceStateChanged({
|
||||
type: 'FailedResourceState',
|
||||
error,
|
||||
error: error.body,
|
||||
lastLoadedState: getLastLoadedResourceState(submissionResourceState),
|
||||
})
|
||||
);
|
||||
|
@ -175,6 +168,13 @@ const submitCreationIfNeeded = async (
|
|||
}
|
||||
};
|
||||
|
||||
const createTrustedAppDeletionSubmissionResourceStateChanged = (
|
||||
newState: Immutable<AsyncResourceState>
|
||||
): Immutable<TrustedAppDeletionSubmissionResourceStateChanged> => ({
|
||||
type: 'trustedAppDeletionSubmissionResourceStateChanged',
|
||||
payload: { newState },
|
||||
});
|
||||
|
||||
const submitDeletionIfNeeded = async (
|
||||
store: ImmutableMiddlewareAPI<TrustedAppsListPageState, AppAction>,
|
||||
trustedAppsService: TrustedAppsService
|
||||
|
@ -209,7 +209,7 @@ const submitDeletionIfNeeded = async (
|
|||
store.dispatch(
|
||||
createTrustedAppDeletionSubmissionResourceStateChanged({
|
||||
type: 'FailedResourceState',
|
||||
error,
|
||||
error: error.body,
|
||||
lastLoadedState: getLastLoadedResourceState(submissionResourceState),
|
||||
})
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue