import { IReduxAction } from "./actions"; import * as Redux from "redux"; export interface IReduxMiddlewareFactory { (actionHandler: (store: Redux.MiddlewareAPI, next: Redux.Dispatch, action: IReduxAction) => void): Redux.Middleware; } /** Returns a utility function, that simplifies creation of Redux Middleware */ export declare function createReduxMiddlewareFactory(): IReduxMiddlewareFactory; /** Defines an error handler */ export interface IMiddlewareErrorHandler { /** Handle the error, return true to indicate the error was handled and should NOT be re-thrown */ handle(error: any, dispatch: Redux.Dispatch): boolean; } /** The default Fetch Api middleware handler */ export declare class FetchApiMiddlewareErrorHandler implements IMiddlewareErrorHandler { private actionType401; private actionTypeUnknownError; /** You can override the redux action types for 401 and unknown errors */ constructor(actionType401?: string, actionTypeUnknownError?: string); handle(err: any, dispatch: Redux.Dispatch): boolean; } /** Create the fetch api middleware */ export declare function createReduxFetchApiMiddleware(reduxMiddlewareFactory: IReduxMiddlewareFactory, errorHandler?: IMiddlewareErrorHandler): Redux.Middleware; /** Create the promise middleware */ export declare function createReduxPromiseMiddleware(reduxMiddlewareFactory: IReduxMiddlewareFactory, errorHandler?: IMiddlewareErrorHandler): Redux.Middleware; /** Create the thunk middleware */ export declare function createReduxThunkMiddleware(reduxMiddlewareFactory: IReduxMiddlewareFactory): Redux.Middleware; /** Create the default middlewares (thunk, promise, fetchApi) */ export declare function createDefaultMiddlewares(fetchApiErrorHandler?: IMiddlewareErrorHandler, promiseErrorHandler?: IMiddlewareErrorHandler): Redux.Middleware[];