mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -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 service = createTrustedAppsServiceMock();
|
||||||
const { store, spyMiddleware } = createStoreSetup(service);
|
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'));
|
store.dispatch(createUserChangedUrlAction('/trusted_apps', '?page_index=2&page_size=50'));
|
||||||
|
|
||||||
|
@ -315,7 +317,7 @@ describe('middleware', () => {
|
||||||
const { store, spyMiddleware } = createStoreSetup(service);
|
const { store, spyMiddleware } = createStoreSetup(service);
|
||||||
|
|
||||||
service.getTrustedAppsList.mockResolvedValue(getTrustedAppsListResponse);
|
service.getTrustedAppsList.mockResolvedValue(getTrustedAppsListResponse);
|
||||||
service.deleteTrustedApp.mockRejectedValue(notFoundError);
|
service.deleteTrustedApp.mockRejectedValue({ body: notFoundError });
|
||||||
|
|
||||||
store.dispatch(createUserChangedUrlAction('/trusted_apps'));
|
store.dispatch(createUserChangedUrlAction('/trusted_apps'));
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ const refreshListIfNeeded = async (
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
createTrustedAppsListResourceStateChangedAction({
|
createTrustedAppsListResourceStateChangedAction({
|
||||||
type: 'FailedResourceState',
|
type: 'FailedResourceState',
|
||||||
error,
|
error: error.body,
|
||||||
lastLoadedState: getLastLoadedListResourceState(store.getState()),
|
lastLoadedState: getLastLoadedListResourceState(store.getState()),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -103,13 +103,6 @@ const refreshListIfNeeded = async (
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const createTrustedAppDeletionSubmissionResourceStateChanged = (
|
|
||||||
newState: Immutable<AsyncResourceState>
|
|
||||||
): Immutable<TrustedAppDeletionSubmissionResourceStateChanged> => ({
|
|
||||||
type: 'trustedAppDeletionSubmissionResourceStateChanged',
|
|
||||||
payload: { newState },
|
|
||||||
});
|
|
||||||
|
|
||||||
const updateCreationDialogIfNeeded = (
|
const updateCreationDialogIfNeeded = (
|
||||||
store: ImmutableMiddlewareAPI<TrustedAppsListPageState, AppAction>
|
store: ImmutableMiddlewareAPI<TrustedAppsListPageState, AppAction>
|
||||||
) => {
|
) => {
|
||||||
|
@ -167,7 +160,7 @@ const submitCreationIfNeeded = async (
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
createTrustedAppCreationSubmissionResourceStateChanged({
|
createTrustedAppCreationSubmissionResourceStateChanged({
|
||||||
type: 'FailedResourceState',
|
type: 'FailedResourceState',
|
||||||
error,
|
error: error.body,
|
||||||
lastLoadedState: getLastLoadedResourceState(submissionResourceState),
|
lastLoadedState: getLastLoadedResourceState(submissionResourceState),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -175,6 +168,13 @@ const submitCreationIfNeeded = async (
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const createTrustedAppDeletionSubmissionResourceStateChanged = (
|
||||||
|
newState: Immutable<AsyncResourceState>
|
||||||
|
): Immutable<TrustedAppDeletionSubmissionResourceStateChanged> => ({
|
||||||
|
type: 'trustedAppDeletionSubmissionResourceStateChanged',
|
||||||
|
payload: { newState },
|
||||||
|
});
|
||||||
|
|
||||||
const submitDeletionIfNeeded = async (
|
const submitDeletionIfNeeded = async (
|
||||||
store: ImmutableMiddlewareAPI<TrustedAppsListPageState, AppAction>,
|
store: ImmutableMiddlewareAPI<TrustedAppsListPageState, AppAction>,
|
||||||
trustedAppsService: TrustedAppsService
|
trustedAppsService: TrustedAppsService
|
||||||
|
@ -209,7 +209,7 @@ const submitDeletionIfNeeded = async (
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
createTrustedAppDeletionSubmissionResourceStateChanged({
|
createTrustedAppDeletionSubmissionResourceStateChanged({
|
||||||
type: 'FailedResourceState',
|
type: 'FailedResourceState',
|
||||||
error,
|
error: error.body,
|
||||||
lastLoadedState: getLastLoadedResourceState(submissionResourceState),
|
lastLoadedState: getLastLoadedResourceState(submissionResourceState),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue