import { Dispatch } from 'redux' ; import { IReduxAction , IReduxAsyncAction } from '../../schemas' ; export function actionCreator < Payload > ( type ) { return ( payload ) : IReduxAction < Payload > => ( { payload , type , } ) ; } export function asyncActionDispatcher < Type = any > ( dispatch , action ) { return new Promise < Type > ( ( resolve , reject ) => { const asyncAction = { ... action , reject , resolve , } ; dispatch ( asyncAction ) ; } ) ; }