File size: 625 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import {
AxiosDataFetcher,
AxiosResponse,
} from "@sitecore-jss/sitecore-jss-nextjs";
/**
* Implements a data fetcher using Axios - replace with your favorite
* SSR-capable HTTP or fetch library if you like. See HttpDataFetcher<T> type
* in sitecore-jss library for implementation details/notes.
* @param {string} url The URL to request; may include query string
* @param {unknown} data Optional data to POST with the request.
*/
export function dataFetcher<ResponseType>(
url: string,
data?: unknown,
): Promise<AxiosResponse<ResponseType>> {
return new AxiosDataFetcher().fetch<ResponseType>(url, data);
}
|