import { FetchResult } from '@apollo/client/core' ; import { CustomQuery } from '@vue-storefront/core' ; import changeCustomerPassword from './changeCustomerPassword' ; import { ChangeCustomerPasswordMutation , ChangeCustomerPasswordMutationVariables , } from '../../types/GraphQL' ; import { Context } from '../../types/context' ; export default async ( context , params , customQuery = { changeCustomerPassword : 'changeCustomerPassword' } ) : Promise < FetchResult < ChangeCustomerPasswordMutation > > => { try { const { changeCustomerPassword : changeCustomerPasswordGQL } = context . extendQuery ( customQuery , { changeCustomerPassword : { query : changeCustomerPassword , variables : { ... params } , } , } ) ; return await context . client . mutate < ChangeCustomerPasswordMutation , ChangeCustomerPasswordMutationVariables > ( { mutation : changeCustomerPasswordGQL . query , variables : changeCustomerPasswordGQL . variables , } ) ; } catch ( error ) { if ( error . graphQLErrors ) { return { errors : error . graphQLErrors , data : null , } ; } throw error . networkError ?. result || error ; } } ;