Skip to content

Commit

Permalink
MAT-7204a axiosInstance added for Intercept
Browse files Browse the repository at this point in the history
  • Loading branch information
ethankaplan committed Jun 26, 2024
1 parent 1e25817 commit 51b5a6d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
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 { axiosInstance as axios } from "../utils/axios-insatnce";
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 { axiosInstance as axios } from "../../utils/axios-insatnce";
import { useEffect, useState } from "react";

export interface OktaConfig {
Expand Down
3 changes: 3 additions & 0 deletions src/components/editCqlLibrary/EditCqlLibrary.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ const organizations = [

jest.mock("axios");
const mockedAxios = axios as jest.Mocked<typeof axios>;
mockedAxios.interceptors = axios.interceptors as jest.Mocked<
typeof axios.interceptors
>;

// mocking useHistory
const mockPush = jest.fn();
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
7 changes: 7 additions & 0 deletions src/utils/axios-insatnce.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import axios from "axios";
import { wafIntercept } from "@madie/madie-util";

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

0 comments on commit 51b5a6d

Please sign in to comment.