import gql from 'graphql-tag' ; import { FetchPolicy , FetchResult } from '@apollo/client/core' ; import { Context } from '../../types/context' ; export default async < MUTATION = any , MUTATION_VARIABLES = any > ( { client } , { mutation , mutationVariables , fetchPolicy , } ) : Promise < FetchResult < MUTATION > > => client . mutate < MUTATION , MUTATION_VARIABLES > ( { mutation : gql `${ mutation }` , variables : { ... mutationVariables } , fetchPolicy : fetchPolicy || 'no-cache' , } ) ;