/** * @license * Copyright Stbui All Rights Reserved. * https://github.com/stbui/prophet */ import { FunctionComponent } from 'react'; interface ChildrenFuncParams { data?: any; total?: number; loading?: boolean; loaded?: boolean; error?: any; } export interface QueryValue { children: (props: ChildrenFuncParams) => JSX.Element; type: string; resource: string; payload?: any; options?: any; } /** * * @param {Function} children * @param {string} type * @param {string} resource * @param {Object} payload * @param {Object} options * @param {string} options.action * @param {Function} options.onSuccess * @param {Function} options.onFailure * * @example * import { Query } from 'prophet-core'; * * const UserProfile = ({ record }) => ( * * {({ data, loading, error }) => { * if (loading) { * return 'loading'; * } * * if (error) { * return error.message; * } * * return
{data.username}
; * }} *
* ); * * const payload = { * pagination: { page: 1, perPage: 10 }, * sort: { field: 'username', order: 'ASC' }, * }; * const UserList = () => ( * * {({ data, total, loading, error }) => { * if (loading) { * return ; * } * if (error) { * return ; * } * * return
total:{total},{data.map(user => user.username)}
; * }} *
* ); */ declare const Query: FunctionComponent; export default Query;