How to use the ra-data-graphql function in ra-data-graphql

To help you get started, we’ve selected a few ra-data-graphql 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 Weakky / ra-data-opencrud / src / adaptator / index.js View on Github external
export default options => {
  return buildDataProvider(merge({}, defaultOptions, options)).then(defaultDataProvider => {
    return (fetchType, resource, params) => {
      // Graphcool does not support multiple deletions so instead we send multiple DELETE requests
      // This can be optimized using the apollo-link-batch-http link
      if (fetchType === DELETE_MANY) {
        const { ids, ...otherParams } = params;
        return Promise.all(
          params.ids.map(id =>
            defaultDataProvider(DELETE, resource, {
              id,
              ...otherParams
            })
          )
        ).then(results => {
          const data = results.reduce((acc, { data }) => [...acc, data.id], []);

          return { data };
github Weakky / ra-data-opencrud / src / index.ts View on Github external
export default (options: {
  client?: ApolloClient;
  clientOptions?: ApolloClientOptions;
}) => {
  return buildDataProvider(merge({}, defaultOptions, options)).then(
    graphQLDataProvider => {
      return (
        fetchType: string,
        resource: string,
        params: { [key: string]: any }
      ): Promise => {
        // Temporary work-around until we make use of updateMany and deleteMany mutations
        if (fetchType === DELETE_MANY) {
          const { ids, ...otherParams } = params;
          return Promise.all(
            params.ids.map((id: string) =>
              graphQLDataProvider(DELETE, resource, {
                id,
                ...otherParams
              })
            )
github marmelab / react-admin / packages / ra-data-graphcool / src / index.js View on Github external
export default options => {
    return buildDataProvider(merge({}, defaultOptions, options)).then(
        defaultDataProvider => {
            return (fetchType, resource, params) => {
                // Graphcool does not support multiple deletions so instead we send multiple DELETE requests
                // This can be optimized using the apollo-link-batch-http link
                if (fetchType === DELETE_MANY) {
                    const { ids, ...otherParams } = params;
                    return Promise.all(
                        params.ids.map(id =>
                            defaultDataProvider(DELETE, resource, {
                                id,
                                ...otherParams,
                            })
                        )
                    ).then(results => {
                        const data = results.reduce(
                            (acc, { data }) => [...acc, data.id],
github Steams / ra-data-hasura-graphql / src / index.js View on Github external
export default options => {
    return buildDataProvider(merge({}, defaultOptions, options)).then(
        dataProvider => {
            return (fetchType, resource, params) => {
                return dataProvider(fetchType, resource, params);
            };
        }
    );
};

ra-data-graphql

A GraphQL data provider for react-admin

MIT
Latest version published 4 days ago

Package Health Score

93 / 100
Full package analysis

Popular ra-data-graphql functions