fetrest
    Preparing search index...

    Class FetchRestSingleton

    Singleton class for making HTTP requests using the Fetch API. RECOMMENDATION: It is recommmeded to use this class instead of base FetchRest for most of the uses

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    baseUrl: string
    fetchFn?: (
        input: string | URL | Request,
        init?: RequestInit,
    ) => Promise<Response>
    fetchOpts?: RequestInit
    handle401: null | FRAuthFailureHandler = null
    hooks: { afterRequest?: FRHook; beforeRequest?: FRHook }
    jwtToken: null | string = null
    logs: boolean
    pendingRequests: Map<string, { promise: Promise<unknown>; timestamp: number }> = ...
    retryCount: number
    retryDelayMs: number
    retryOn: number[]

    Singleton instance of FetchRestSingleton.

    ongoing401Handler: null | Promise<void> = null

    Methods

    • Parameters

      • url: string
      • method: string
      • Optionalbody: unknown

      Returns string

    • Parameters

      • path: string
      • Optionalparams: Record<string, string | number>
      • Optionalquery: Record<string, undefined | string | number | boolean | string[] | number[]>

      Returns string

    post