@logilab/cwelements
Version:
Library of reusable React components for building web application with cubicweb
27 lines (26 loc) • 737 B
TypeScript
import * as React from 'react';
import { client } from '@logilab/cwclientlibjs';
import { RqlParser } from './RqlParser';
export interface RqlQuerierProps {
rqlClient: client.RqlClient;
readonly?: boolean;
}
export declare type RqlQueryResult = {
rows: client.RqlRows;
status: 'success';
} | {
reason: string;
status: 'error';
};
export declare function useQuery({ rqlClient, readonly }: RqlQuerierProps): {
query: string;
setQuery: React.Dispatch<React.SetStateAction<string>>;
resultsAndVariables: {
results: RqlQueryResult | null;
variables: string[] | null;
};
executeQuery: () => void;
queryIsLoading: boolean;
parser: RqlParser;
isForbiddenQuery: boolean;
};