ordinary-sapphireO
Refine15mo ago
7 replies
ordinary-sapphire

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
    }
  }
`);


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);



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
Was this page helpful?