Skip to content

Commit 2d16727

Browse files
Update intercept to check logout request (#1650) (#1657)
* update intercept to check logout request * change controller to unused variable --------- (cherry picked from commit 606bc71) Signed-off-by: Shenoy Pratik <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 3be2d39 commit 2d16727

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

public/framework/catalog_cache/cache_intercept.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import {
7-
HttpInterceptorResponseError,
8-
IHttpInterceptController,
9-
} from '../../../../../src/core/public';
6+
import { HttpFetchOptionsWithPath, IHttpInterceptController } from '../../../../../src/core/public';
107
import { CatalogCacheManager } from './cache_manager';
118

12-
export function catalogCacheInterceptError(): any {
13-
return (httpErrorResponse: HttpInterceptorResponseError, _: IHttpInterceptController) => {
14-
if (httpErrorResponse.response?.status === 401) {
9+
export function catalogRequestIntercept(): any {
10+
return (
11+
fetchOptions: Readonly<HttpFetchOptionsWithPath>,
12+
_controller: IHttpInterceptController
13+
) => {
14+
if (fetchOptions.path.includes('/logout')) {
1515
// Clears all user catalog cache details
1616
CatalogCacheManager.clearDataSourceCache();
1717
CatalogCacheManager.clearAccelerationsCache();

public/plugin.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { createGetterSetter } from '../../../src/plugins/opensearch_dashboards_u
2020
import { CREATE_TAB_PARAM, CREATE_TAB_PARAM_KEY, TAB_CHART_ID } from '../common/constants/explorer';
2121
import {
2222
DATACONNECTIONS_BASE,
23-
S3_DATASOURCE_TYPE,
2423
observabilityApplicationsID,
2524
observabilityApplicationsPluginOrder,
2625
observabilityApplicationsTitle,
@@ -46,6 +45,7 @@ import {
4645
observabilityTracesID,
4746
observabilityTracesPluginOrder,
4847
observabilityTracesTitle,
48+
S3_DATASOURCE_TYPE,
4949
} from '../common/constants/shared';
5050
import { QueryManager } from '../common/query_manager';
5151
import { AssociatedObject, CachedAcceleration } from '../common/types/data_connections';
@@ -72,7 +72,7 @@ import {
7272
OBSERVABILITY_EMBEDDABLE_ID,
7373
} from './embeddable/observability_embeddable';
7474
import { ObservabilityEmbeddableFactoryDefinition } from './embeddable/observability_embeddable_factory';
75-
import { catalogCacheInterceptError } from './framework/catalog_cache/cache_intercept';
75+
import { catalogRequestIntercept } from './framework/catalog_cache/cache_intercept';
7676
import {
7777
useLoadAccelerationsToCache,
7878
useLoadDatabasesToCache,
@@ -402,7 +402,7 @@ export class ObservabilityPlugin
402402
});
403403

404404
core.http.intercept({
405-
responseError: catalogCacheInterceptError(),
405+
request: catalogRequestIntercept(),
406406
});
407407

408408
// Use overlay service to render flyouts

0 commit comments

Comments
 (0)