react-http-fetch
Version:
An http library for React JS built on top of native JS fetch
27 lines (26 loc) • 880 B
TypeScript
import { HttpRequestActions } from './actions';
/**
* The action to dispatch when a request starts.
*/
declare type RequestInitAction = {
type: HttpRequestActions.RequestInit;
};
export declare const requestInit: () => RequestInitAction;
/**
* The action to dispatch when a request completes successfully.
*/
declare type RequestSuccessAction<PayloadT> = {
type: HttpRequestActions;
payload: PayloadT;
};
export declare const requestSuccess: <PayloadT>(payload: PayloadT) => RequestSuccessAction<PayloadT>;
/**
* The action to dispatch when the request goes in error.
*/
declare type RequestErrorAction = {
type: HttpRequestActions;
payload: unknown;
};
export declare const requestError: (payload: unknown) => RequestErrorAction;
export declare type HttpReqActionType = RequestInitAction | RequestErrorAction | RequestSuccessAction<unknown>;
export {};