Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAT-7204: add intercept for waf #145

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/api/useCqlLibraryServiceApi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import useServiceConfig from "./useServiceConfig";
import { ServiceConfig } from "./ServiceContext";
import { CqlLibrary } from "@madie/madie-models";
import useOktaTokens from "../hooks/useOktaTokens";

import { wafIntercept } from "@madie/madie-util";
export class CqlLibraryServiceApi {
constructor(private baseUrl: string, private getAccessToken: () => string) {}

Expand Down Expand Up @@ -101,6 +101,10 @@ export class CqlLibraryServiceApi {
}
}

axios.interceptors.response.use((response) => {
return response;
}, wafIntercept);

export default function useCqlLibraryServiceApi() {
const serviceConfig: ServiceConfig = useServiceConfig();
const { getAccessToken } = useOktaTokens();
Expand Down
6 changes: 5 additions & 1 deletion src/components/config/useGetServiceConfig.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from "axios";
import { useEffect, useState } from "react";

import { wafIntercept } from "@madie/madie-util";
export interface OktaConfig {
baseUrl: string;
issuer: string;
Expand All @@ -23,6 +23,10 @@ export interface ServiceConfig {
};
}

axios.interceptors.response.use((response) => {
return response;
}, wafIntercept);

const useGetServiceConfig = () => {
const [config, setConfig] = useState<ServiceConfig | null>(null);
const [error, setError] = useState<Error | null>(null);
Expand Down
2 changes: 2 additions & 0 deletions src/types/madie-madie-util.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ declare module "@madie/madie-util" {
draft?: boolean
): boolean;

export function wafIntercept(): void;

export const bootstrap: LifeCycleFn<void>;
export const mount: LifeCycleFn<void>;
export const unmount: LifeCycleFn<void>;
Expand Down
Loading