drupal-react-oauth-provider
Version:
Drupal React Oauth Provider and Hooks for REST / JSONAPI etc.
19 lines (18 loc) • 643 B
TypeScript
import { Error } from '../returnTypes';
export declare type Params = {
readonly endpoint: string;
readonly method?: 'GET' | 'POST' | 'PATCH' | 'DELETE';
readonly body?: object;
_execute?: boolean;
};
/**
* Ignore _execute. It is used for lazyAPI.
* Add ?_format=hal_json or &_format=hal_json to the endpoint if it is required. Otherwise, _format=json will be added automatically.
* @example
* const { data, loading, error } = useAPI({ endpoint, method, body });
*/
export declare const useAPI: ({ body, method, endpoint, _execute }: Params) => {
loading: boolean;
error: Error;
data: any;
};