UNPKG

decent-sdk

Version:

SDK for the Decent API

13 lines (12 loc) 656 B
import { GenericFetchParams } from './params'; export declare const SessionIdKeyInLocalStorage = "decent-sessionId"; /** * Generic fetch function that handles API calls and error checking. * @param params - The parameters for the fetch request. * @param params.route - The API route to call. * @param params.options - Optional RequestInit options. * @param params.apiUrl - Optional API URL override. * @returns {Promise<T>} A promise with the data from the API response. * @throws {Error} Will throw an error if the API response indicates failure. */ export declare const genericFetchAndThrowIfError: <T>(params: GenericFetchParams) => Promise<T>;