How to pass variables for graphql query in specific format?

This is my mutation
export const SIGNUP_MUTATION: TypedDocumentNode<AuthResponse, SignupVariables> = parse(gql`
mutation Signup($input: SignupInput!) {
signup(input: $input) {
sessionId
}
}
`);
export const SIGNUP_MUTATION: TypedDocumentNode<AuthResponse, SignupVariables> = parse(gql`
mutation Signup($input: SignupInput!) {
signup(input: $input) {
sessionId
}
}
`);
this is my data provider
"use client";

import graphqlDataProvider, { ClientError, gql, GraphQLClient, RequestDocument } from "@refinedev/graphql";
import { GraphQLError, parse } from "graphql";

export const API_URL = process.env.NEXT_PUBLIC_API_URL as string;

const MAX_RETRIES = 3;
const RETRY_DELAY = 500;

type AuthResponse = {
data: unknown | null;
errors: GraphQLError[];
};
export const client = new GraphQLClient(API_URL, {
credentials: "include",
});

export const dataProvider = graphqlDataProvider(client);
"use client";

import graphqlDataProvider, { ClientError, gql, GraphQLClient, RequestDocument } from "@refinedev/graphql";
import { GraphQLError, parse } from "graphql";

export const API_URL = process.env.NEXT_PUBLIC_API_URL as string;

const MAX_RETRIES = 3;
const RETRY_DELAY = 500;

type AuthResponse = {
data: unknown | null;
errors: GraphQLError[];
};
export const client = new GraphQLClient(API_URL, {
credentials: "include",
});

export const dataProvider = graphqlDataProvider(client);
but it seems that graphqlDataProvider expects the variable in this format: { input: data { .... } } i don't want to nest it inside data, how can i fix it
4 Replies
kapa.ai
kapa.ai2d ago
Hi @Supa hot fire. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. However, you can refer to the Refine GraphQL documentation (https://refine.dev/docs/guides-concepts/data-fetching/#graphql) for more information on how to handle GraphQL queries and mutations with Refine. This might provide some insights into how to structure your variables for the graphqlDataProvider. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2d ago
<@541506908301819930> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
foreign-sapphire
foreign-sapphire2d ago
i checked that sources but the examples given are not passing in the required structure, @kapa.ai
kapa.ai
kapa.ai2d ago
Let me check the knowledge base for you again. One moment! :books: Sorry @Supa hot fire, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?