Skip to content

Commit

Permalink
MAT-7204 change axios import
Browse files Browse the repository at this point in the history
  • Loading branch information
ethankaplan committed Jun 27, 2024
1 parent 4864598 commit 709b2b1
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
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 { axiosInstance as axios } from "../utils/axios-insatnce";
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 { axiosInstance as axios } from "../../utils/axios-insatnce";
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
7 changes: 0 additions & 7 deletions src/utils/axios-insatnce.ts

This file was deleted.

0 comments on commit 709b2b1

Please sign in to comment.