Skip to content

Using GraphQL in Zimlets

Peter Lenahan edited this page Jul 10, 2019 · 5 revisions

TODO

import gql from 'graphql-tag';
import { graphql } from 'react-apollo';

@graphql(gql`
  query AccountInfo {
    accountInfo {
      id
      prefs {
        zimbraPrefGroupMailBy
      }
    }
  }
`)
class MyClass extends Component {
  render({ data }) {
    const { loading, error, accountInfo } = data;
    return loading ? (
      'Account Info Loading...'
    ) : error ? (
      `Account Info ERROR: ${error}`
    ) : (
      <div>Some data from accountInfo: {accountInfo.prefs.zimbraPrefGroupMailBy}
    );
  }
}
Clone this wiki locally