import axios, { AxiosRequestConfig, AxiosResponse } from "axios"; export type AxiosGetRequest = { urls: string[]; axiosConfig?: AxiosRequestConfig; makeGetRequest?: (url: string, axiosConfig?: AxiosRequestConfig) => Promise>; }; export const fetchWithFallbacks = (args: AxiosGetRequest): Promise> => { const makeGetRequest = args.makeGetRequest ?? axios.get.bind(axios); const requests = args.urls.map((url) => makeGetRequest(url, args.axiosConfig)); return Promise.any(requests); };