Alokai

changeCustomerPassword

Change customer password.

Signature

declare function changeCustomerPassword(
	context: Context,
	params: {
  currentPassword: string;
  newPassword: string;
},
	customQuery?: CustomQuery,
	customHeaders?: CustomHeaders
): Promise<FetchResult<ChangeCustomerPasswordMutation>>;

Parameters

NameRequiredTypeDescription
contextRequiredContext
paramsRequired{ currentPassword: string; newPassword: string; }
customQueryOptionalCustomQuery
customHeadersOptionalCustomHeaders

Referenced Types

Examples

Simple usage, change customer password:

import { sdk } from '~/sdk.config.ts';

const result = await sdk.magento.changeCustomerPassword({
 currentPassword: 'currentPassword',
 newPassword: 'newPassword'
});

Creating a custom GraphQL query for changeCustomerPassword:

module.exports = {
  integrations: {
    magento: {
      customQueries: {
        'change-customer-password-custom-query': ({ variables, metadata }) => ({
           variables,
           query: `
             mutation changeCustomerPassword($currentPassword: String!, $newPassword: String!) {
              changeCustomerPassword(
                currentPassword: $currentPassword
                newPassword: $newPassword
              ) {
                ${metadata.fields}
              }
            }
           `
        }),
      },
    }
  }
};

Using a custom GraphQL query to narrow down the response data:

import { sdk } from '~/sdk.config.ts';
// reduce the amount of fields returned by the query, when compared to the default query
const customQuery = {
  changeCustomerPassword: 'change-customer-password-custom-query',
  metadata: {
    fields: 'email'
  }
};

const result = await sdk.magento.changeCustomerPassword({
 currentPassword: 'currentPassword',
 newPassword: 'newPassword'
}, customQuery);

On this page