signOutCurrentUser method

Future<void> signOutCurrentUser()

Signs out the current user and clears it from the disk cache.

Implementation

Future<void> signOutCurrentUser() async {
  if (await isAccessTokenExpired) {
    log('currentCustomerAccessTokenExpired');
    await _setShopifyUser(null, null);
    return;
  }
  final MutationOptions _options = MutationOptions(
      document: gql(accessTokenDeleteMutation),
      variables: {'customerAccessToken': await currentCustomerAccessToken});
  await _setShopifyUser(null, null);
  final QueryResult result = await _graphQLClient!.mutate(_options);
  checkForError(
    result,
    key: 'customerAccessTokenDelete',
    errorKey: 'userErrors',
  );
}