signInWithEmailAndPassword method
Tries to sign in a user with the given email address and password.
Implementation
Future<ShopifyUser> signInWithEmailAndPassword({
required String email,
required String password,
bool deleteThisPartOfCache = false,
}) async {
final String? customerAccessToken = await _createAccessToken(
email,
password,
);
final WatchQueryOptions _getCustomer = WatchQueryOptions(
document: gql(getCustomerQuery),
variables: {'customerAccessToken': customerAccessToken});
final QueryResult result = await _graphQLClient!.query(_getCustomer);
checkForError(result);
final shopifyUser = ShopifyUser.fromGraphJson(result.data!['customer']);
await _setShopifyUser(customerAccessToken, shopifyUser);
if (deleteThisPartOfCache) {
_graphQLClient!.cache.writeQuery(_getCustomer.asRequest, data: {});
}
return shopifyUser;
}