Add some TS Docs around axios configuration

update README
This commit is contained in:
Violet Caulfield
2025-12-24 07:22:58 -06:00
parent 170d483da7
commit 8536ca67bf
2 changed files with 12 additions and 1 deletions

View File

@@ -231,7 +231,6 @@ Install via [Altstore](https://altstore.io) or your favorite sideloading utility
[React Native Blurhash](https://github.com/mrousavy/react-native-blurhash)\
[React Native CarPlay](https://github.com/birkir/react-native-carplay)\
[React Native Sortables](https://github.com/MatiPl01/react-native-sortables)\
[React Native Nitro Modules](https://github.com/mrousavy/react-native-nitro-modules)\
[React Native Reanimated](https://docs.swmansion.com/react-native-reanimated/)\
[React Native Toast Message](https://github.com/calintamas/react-native-toast-message)\
[React Native Vector Icons](https://github.com/oblador/react-native-vector-icons)
@@ -246,6 +245,8 @@ Install via [Altstore](https://altstore.io) or your favorite sideloading utility
[React Native File Access](https://github.com/alpha0010/react-native-file-access)\
[React Native Google Cast](https://github.com/react-native-google-cast/react-native-google-cast)\
[React Native MMKV](https://github.com/mrousavy/react-native-mmkv)\
[React Native Nitro Fetch](https://github.com/margelo/react-native-nitro-fetch)\
[React Native Nitro Modules](https://github.com/mrousavy/react-native-nitro-modules)\
[React Native Nitro OTA](https://github.com/riteshshukla04/react-native-nitro-ota)\
[React Native Track Player](https://github.com/doublesymmetry/react-native-track-player)\
[React Native URL Polyfill](https://github.com/charpeni/react-native-url-polyfill)\

View File

@@ -1,6 +1,14 @@
import axios, { AxiosAdapter } from 'axios'
import { fetch } from 'react-native-nitro-fetch'
/**
* Custom Axios adapter using {@link fetch} from `react-native-nitro-fetch`.
*
* This will handle HTTP requests made through Axios by leveraging the Nitro Fetch API.
*
* @param config the Axios request config
* @returns
*/
const nitroAxiosAdapter: AxiosAdapter = async (config) => {
const response = await fetch(config.url!, {
method: config.method?.toUpperCase(),
@@ -30,6 +38,8 @@ const nitroAxiosAdapter: AxiosAdapter = async (config) => {
/**
* The Axios instance for making HTTP requests.
*
* Leverages the {@link nitroAxiosAdapter} for handling requests.
*
* Default timeout is set to 60 seconds.
*/
const AXIOS_INSTANCE = axios.create({