genetic-orange
genetic-orange3y ago

custom queries

how to send raw graphql queries with meta data of useTAble am using hasura data provider
7 Replies
genetic-orange
genetic-orangeOP3y 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
sensitive-blue
sensitive-blue3y 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
genetic-orange
genetic-orangeOP3y ago
hasura data provider
sensitive-blue
sensitive-blue3y 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"] }],
},
});
genetic-orange
genetic-orangeOP3y ago
i need custom gql not this way this one is the basic one which is in refine
sensitive-blue
sensitive-blue3y 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.
genetic-orange
genetic-orangeOP3y ago
ok

Did you find this page helpful?