How to use the ra-data-graphql-simple.buildQuery function in ra-data-graphql-simple

To help you get started, we’ve selected a few ra-data-graphql-simple examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github marmelab / react-admin / examples / demo / src / dataProvider / graphql.js View on Github external
const customBuildQuery = introspectionResults => {
    const buildQuery = buildQueryFactory(introspectionResults);

    return (type, resource, params) => {
        if (type === DELETE) {
            return {
                query: gql`mutation remove${resource}($id: ID!) {
                    remove${resource}(id: $id)
                }`,
                variables: { id: params.id },
                parseResponse: ({ data }) => {
                    if (data[`remove${resource}`]) {
                        return { data: { id: params.id } };
                    }

                    throw new Error(`Could not delete ${resource}`);
                }
            }

ra-data-graphql-simple

A GraphQL simple data provider for react-admin

MIT
Latest version published 2 days ago

Package Health Score

93 / 100
Full package analysis