How to use the @apollo/react-common.DocumentType.Mutation function in @apollo/react-common

To help you get started, we’ve selected a few @apollo/react-common 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 apollographql / react-apollo / packages / hoc / src / graphql.tsx View on Github external
TProps extends TGraphQLVariables | {} = {},
  TData = {},
  TGraphQLVariables = {},
  TChildProps = Partial> &
    Partial>
>(
  document: DocumentNode,
  operationOptions: OperationOption<
    TProps,
    TData,
    TGraphQLVariables,
    TChildProps
  > = {}
) {
  switch (parser(document).type) {
    case DocumentType.Mutation:
      return withMutation(document, operationOptions);
    case DocumentType.Subscription:
      return withSubscription(document, operationOptions);
    case DocumentType.Query:
    default:
      return withQuery(document, operationOptions);
  }
}
github apollographql / react-apollo / packages / hooks / src / data / MutationData.ts View on Github external
constructor({
    options,
    context,
    result,
    setResult
  }: {
    options: MutationOptions;
    context: ApolloContextValue;
    result: MutationResult;
    setResult: (result: MutationResult) => any;
  }) {
    super(options, context);
    this.verifyDocumentType(options.mutation, DocumentType.Mutation);
    this.result = result;
    this.setResult = setResult;
    this.mostRecentMutationId = 0;
  }