urgent-maroonU
Refine2y ago
43 replies
urgent-maroon

Not getting useList with Hasura as GraphQL provider to work

This is my dataProvider:
import graphqlDataProvider, {
  GraphQLClient,
  liveProvider as graphqlLiveProvider,
  graphqlWS,
} from "@refinedev/hasura";

// Update the GraphQL client initialization to use the Hasura endpoint URL
export const API_BASE_URL = import.meta.env.VITE_HASURA_BASE_URL;
export const API_URL = `${API_BASE_URL}/v1/graphql`;
export const WS_URL = import.meta.env.VITE_HASURA_WS_URL;

export const client = new GraphQLClient(API_URL, {
  headers: {
    "x-hasura-role": "admin",
    "x-hasura-admin-secret": "xxx"
  },
});

export const wsClient = graphqlWS.createClient({
  url: WS_URL,
});

export const dataProvider = graphqlDataProvider(client, { namingConvention: "graphql-default" });


This is my query:
export const DASHBOARD_TASKS_CHART_QUERY = gql`
    query DashboardTasksChart(
        $where: TaskStagesBoolExp!
        $orderBy: [TaskStagesOrderBy!]
        $limit: Int!
        $offset: Int!
    ) {
        taskStages(where: $where, orderBy: $orderBy, limit: $limit, offset: $offset) {
            title
            tasksAggregate {
                aggregate {
                    count(columns: id)
                }
            }
        }
    }
`;
Was this page helpful?