custom queries

how to send raw graphql queries with meta data of useTAble am using hasura data provider
7 Replies
provincial-silver
provincial-silverOP3y 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
inland-turquoise
inland-turquoise3y 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
provincial-silver
provincial-silverOP3y ago
hasura data provider
inland-turquoise
inland-turquoise3y 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"] }],
},
});
provincial-silver
provincial-silverOP3y ago
i need custom gql not this way this one is the basic one which is in refine
inland-turquoise
inland-turquoise3y 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.
provincial-silver
provincial-silverOP3y ago
ok

Did you find this page helpful?