ghost-portal/packages/ui-react-rx/src/with/apiDiv.ts
Jaco Greeff 078e2e431a
Support enumerable accounts (#102)
Covert to TypeScript
2018-06-25 18:02:47 +02:00

18 lines
692 B
TypeScript

// Copyright 2017-2018 @polkadot/ui-react-rx authors & contributors
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
import { BaseProps } from '../types';
import { ApiMethod, ComponentRenderer, DefaultProps, RenderFn, Options } from './types';
import Div from '../Div';
import withApiCall from './apiCall';
export default function withApiDiv<T, Props extends BaseProps<T>> (call: ApiMethod, options?: Options<T>): ComponentRenderer<T> {
return (render: RenderFn, defaultProps: DefaultProps<T> = {}): React.ComponentType<Props> =>
withApiCall(call, options)(Div, {
...defaultProps,
render
});
}