Skip to content

Commit

Permalink
Update intercept to check logout request (opensearch-project#1650) (o…
Browse files Browse the repository at this point in the history
…pensearch-project#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>
  • Loading branch information
1 parent 3be2d39 commit 2d16727
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions public/framework/catalog_cache/cache_intercept.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
* SPDX-License-Identifier: Apache-2.0
*/

import {
HttpInterceptorResponseError,
IHttpInterceptController,
} from '../../../../../src/core/public';
import { HttpFetchOptionsWithPath, IHttpInterceptController } from '../../../../../src/core/public';
import { CatalogCacheManager } from './cache_manager';

export function catalogCacheInterceptError(): any {
return (httpErrorResponse: HttpInterceptorResponseError, _: IHttpInterceptController) => {
if (httpErrorResponse.response?.status === 401) {
export function catalogRequestIntercept(): any {
return (
fetchOptions: Readonly<HttpFetchOptionsWithPath>,
_controller: IHttpInterceptController
) => {
if (fetchOptions.path.includes('/logout')) {
// Clears all user catalog cache details
CatalogCacheManager.clearDataSourceCache();
CatalogCacheManager.clearAccelerationsCache();
Expand Down
6 changes: 3 additions & 3 deletions public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { createGetterSetter } from '../../../src/plugins/opensearch_dashboards_u
import { CREATE_TAB_PARAM, CREATE_TAB_PARAM_KEY, TAB_CHART_ID } from '../common/constants/explorer';
import {
DATACONNECTIONS_BASE,
S3_DATASOURCE_TYPE,
observabilityApplicationsID,
observabilityApplicationsPluginOrder,
observabilityApplicationsTitle,
Expand All @@ -46,6 +45,7 @@ import {
observabilityTracesID,
observabilityTracesPluginOrder,
observabilityTracesTitle,
S3_DATASOURCE_TYPE,
} from '../common/constants/shared';
import { QueryManager } from '../common/query_manager';
import { AssociatedObject, CachedAcceleration } from '../common/types/data_connections';
Expand All @@ -72,7 +72,7 @@ import {
OBSERVABILITY_EMBEDDABLE_ID,
} from './embeddable/observability_embeddable';
import { ObservabilityEmbeddableFactoryDefinition } from './embeddable/observability_embeddable_factory';
import { catalogCacheInterceptError } from './framework/catalog_cache/cache_intercept';
import { catalogRequestIntercept } from './framework/catalog_cache/cache_intercept';
import {
useLoadAccelerationsToCache,
useLoadDatabasesToCache,
Expand Down Expand Up @@ -402,7 +402,7 @@ export class ObservabilityPlugin
});

core.http.intercept({
responseError: catalogCacheInterceptError(),
request: catalogRequestIntercept(),
});

// Use overlay service to render flyouts
Expand Down

0 comments on commit 2d16727

Please sign in to comment.