customerUpdate method
Updates the customer to which customerAccessToken belongs to.
Implementation
Future<void> customerUpdate(
{String? email,
String? firstName,
String? lastName,
String? password,
String? phoneNumber,
String? customerAccessToken,
bool? acceptsMarketing,
bool deleteThisPartOfCache = false}) async {
Map<String, dynamic> variableMap = {};
({
'email': email,
'firstName': firstName,
'lastName': lastName,
'password': password,
'phone': phoneNumber,
'acceptsMarketing': acceptsMarketing,
'customerAccessToken': customerAccessToken
}).forEach((k, v) => v != {} ? variableMap[k] = v : {});
final MutationOptions _options = MutationOptions(
document: gql(createValidMutationString(variableMap)),
variables: variableMap);
QueryResult result = await _graphQLClient!.mutate(_options);
checkForError(
result,
key: 'customerUpdate',
errorKey: 'customerUserErrors',
);
if (deleteThisPartOfCache) {
_graphQLClient!.cache.writeQuery(_options.asRequest, data: {});
}
}