dependent-tan
dependent-tan2y ago

custom queries

how to send raw graphql queries with meta data of useTAble am using hasura data provider
7 Replies
dependent-tan
dependent-tan2y ago
const query = gql.query({ operation: "appointments", fields: ["id", { patient: ["name", "first_name"] }], }); const { tableProps: customres } = useTable({ resource: "appointments", metaData: query, }); i created custom query and passed in useTAble this way but data is undefined import * as gql from "gql-query-builder"; imported this way
harsh-harlequin
harsh-harlequin2y ago
Hey @rehan1, If your query consist of operation and fields properties. you can use; metaData.operation and metaData.fields Not sure if the rest of the stuff appending by the data provider gets on your way
dependent-tan
dependent-tan2y ago
hasura data provider
harsh-harlequin
harsh-harlequin2y ago
const { tableProps: customres } = useTable({
resource: "appointments",
metaData: {
operation: "appointments",
fields: ["id", { patient: ["name", "first_name"] }],
},
});
const { tableProps: customres } = useTable({
resource: "appointments",
metaData: {
operation: "appointments",
fields: ["id", { patient: ["name", "first_name"] }],
},
});
dependent-tan
dependent-tan2y ago
i need custom gql not this way this one is the basic one which is in refine
harsh-harlequin
harsh-harlequin2y ago
Unfortunately, currently there's no support for custom queries like this. You can use useCustom with metaData properties like operation, fields and variables which are sent to gql.query function. If this does not cover your case, you can import request (or rawRequest) and gql from @pankod/refine-hasura to send your request manually but this will be separated from the useTable and its pagination logic.
dependent-tan
dependent-tan2y ago
ok