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-7204a: WAFIntercept #147

Merged
merged 3 commits into from
Jul 1, 2024
Merged
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
9 changes: 9 additions & 0 deletions src/api/axios-instance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import axiosReal from "axios";
import { wafIntercept } from "@madie/madie-util";

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

export default axios;
2 changes: 1 addition & 1 deletion src/api/useCqlLibraryServiceApi.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios from "axios";
import axios from "./axios-instance";
import useServiceConfig from "./useServiceConfig";
import { ServiceConfig } from "./ServiceContext";
import { CqlLibrary } from "@madie/madie-models";
Expand Down
2 changes: 1 addition & 1 deletion src/components/config/useGetServiceConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios from "axios";
import axios from "../../api/axios-instance";
import { useEffect, useState } from "react";

export interface OktaConfig {
Expand Down
4 changes: 2 additions & 2 deletions src/components/editCqlLibrary/EditCqlLibrary.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { MemoryRouter, Route } from "react-router";
import userEvent from "@testing-library/user-event";
import { ApiContextProvider, ServiceConfig } from "../../api/ServiceContext";
import { Simulate } from "react-dom/test-utils";
import axios from "axios";
import axios from "../../api/axios-instance";
import {
ElmTranslationExternalError,
isUsingEmpty,
Expand Down Expand Up @@ -77,7 +77,7 @@ const organizations = [
},
];

jest.mock("axios");
jest.mock("../../api/axios-instance");
const mockedAxios = axios as jest.Mocked<typeof axios>;

// mocking useHistory
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