import gql from 'graphql-tag' import { graphql, compose } from 'react-apollo' const PostDomain = gql` mutation PostDomain($domain: DomainInput! , $orgKey: String) { postDomain(domain: $domain, orgKey: $orgKey) { name } }` const DeleteDomain = gql` mutation DeleteDomain($orgKey: String, $name: String) { deleteDomain(orgKey: $orgKey, name: $name) { } }` const withAppSyncDomain = compose( graphql(DeleteDomain, { props: (props) => ({ deleteDomain: ownProps => props.mutate({ variables: { orgKey: ownProps.orgKey, name: ownProps.name }, optimisticResponse: () => ({ deleteDomain: { ...ownProps, __typename: 'Domain', version: 1 } }) }) }) }) ) export { PostDomain, DeleteDomain, withAppSyncDomain }