diff options
| author | Ritesh Ghosh <[email protected]> | 2024-03-03 20:05:42 +0530 |
|---|---|---|
| committer | Ritesh Ghosh <[email protected]> | 2024-03-03 20:05:42 +0530 |
| commit | 4782a8dd708ec1f68bf469907024c082d606dc79 (patch) | |
| tree | 03be9ef0c4c138b7321f23dee73eb9f8b8c696e2 /src/config | |
| parent | a6f99bf681d27483d6f214c48673b875d3cbf6ab (diff) | |
| download | aniwatch-api-4782a8dd708ec1f68bf469907024c082d606dc79.tar.xz aniwatch-api-4782a8dd708ec1f68bf469907024c082d606dc79.zip | |
feat: add axios config for future code reusability
Diffstat (limited to 'src/config')
| -rw-r--r-- | src/config/axios.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/config/axios.ts b/src/config/axios.ts new file mode 100644 index 0000000..6292e9f --- /dev/null +++ b/src/config/axios.ts @@ -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 }; |
