Skip to content

Commit

Permalink
feat: add axios config for future code reusability
Browse files Browse the repository at this point in the history
  • Loading branch information
ghoshRitesh12 committed Mar 3, 2024
1 parent a6f99bf commit 4782a8d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/config/axios.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import axios, { AxiosError, type AxiosRequestConfig } from "axios";
import {
SRC_BASE_URL,
ACCEPT_HEADER,
USER_AGENT_HEADER,
ACCEPT_ENCODING_HEADER,
} from "../utils/constants.js";

const clientConfig: AxiosRequestConfig = {
timeout: 10000,
baseURL: SRC_BASE_URL,
headers: {
Accept: ACCEPT_HEADER,
"User-Agent": USER_AGENT_HEADER,
"Accept-Encoding": ACCEPT_ENCODING_HEADER,
},
};

const client = axios.create(clientConfig);

export { client, AxiosError };

0 comments on commit 4782a8d

Please sign in to comment.