custom queries

how to send raw graphql queries with meta data of useTAble am using hasura data provider
7 Replies
optimistic-gold
optimistic-gold2y 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
flat-fuchsia
flat-fuchsia2y 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
optimistic-gold
optimistic-gold2y ago
hasura data provider
flat-fuchsia
flat-fuchsia2y 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"] }],
},
});
optimistic-gold
optimistic-gold2y ago
i need custom gql not this way this one is the basic one which is in refine
flat-fuchsia
flat-fuchsia2y 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.
optimistic-gold
optimistic-gold2y ago
ok