Mutation Error #1817
vadim-roshuor
started this conversation in
General
Mutation Error
#1817
Replies: 1 comment 1 reply
-
Hey @vadim-roshuor , import * as gql from "gql-query-builder";
const API_URL = "https://flowing-mammal-24.hasura.app/v1/graphql";
const client = new GraphQLClient(API_URL, {
headers: {
"x-hasura-role": "public",
},
});
const gqlDataProvider = dataProvider(client);
export const myDataProvider = (client: GraphQLClient): DataProvider => {
return {
...gqlDataProvider,
deleteOne: async ({ resource, id, metaData }) => {
const operation = metaData?.operation ?? resource;
const deleteOperation = `delete_${operation}_by_pk`;
const { query, variables } = gql.mutation({
operation: deleteOperation,
variables: {
id: { value: id, type: "bigint", required: true },
...metaData?.variables,
},
fields: metaData?.fields ?? ["id"],
});
const response = await client.request(query, variables);
return {
data: response[deleteOperation],
};
},
}; |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey!
I need help
When I try to delete any item I get error : variable "id" is declared as uuid!, but used where bigint!
Response:
How I can fix this error or change this fragment (query: "mutation ($id: uuid!) ) to query: "mutation ($id: bigint!) ?
Thank you
Beta Was this translation helpful? Give feedback.
All reactions