UNPKG

@gdwc/drupal-state

Version:

A simple data store to manage application state sourced from Drupal's JSON:API.

21 lines (18 loc) 876 B
import * as http from 'http'; import { ServerResponse } from 'http'; import { fetchAdapter } from '../types/types.js'; import DrupalState from '../DrupalState.js'; import 'jsona/lib/JsonaTypes'; import 'drupal-jsonapi-params'; import 'zustand/vanilla'; /** * fetch data from a JSON:API endpoint * @param apiUrl the api url for the JSON:API endpoint * @param requestInit fetch initialization object * @param onError custom error handler defaults to throw error * @param res response object * @param fetch fetch compatible function * @returns a promise containing the data for the JSON:API response */ declare const fetchJsonapiEndpoint: (apiUrl: string, requestInit?: {}, onError?: DrupalState['onError'], res?: boolean | ServerResponse<http.IncomingMessage> | undefined, fetch?: fetchAdapter) => Promise<void | Response>; export { fetchJsonapiEndpoint as default };