deleteAccountByEmail static method

Future<AuthResult> deleteAccountByEmail(
  1. String email,
  2. String passCode
)

reset password by email.

Implementation

static Future<AuthResult> deleteAccountByEmail(
    String email, String passCode) async {
  Map map = {};
  map.putIfAbsent('email', () => email);
  map.putIfAbsent('passCode', () => passCode);

  var body = {'verifyMethod': 'EMAIL_PASSCODE', 'emailPassCodePayload': map};
  final Result tokenResult =
      await post('/api/v3/verify-delete-account-request', jsonEncode(body));
  if (tokenResult.statusCode == 200) {
    var resultBody = {
      'deleteAccountToken': tokenResult.data['deleteAccountToken'],
    };
    final Result result =
        await post('/api/v3/delete-account', jsonEncode(resultBody));
    AuthResult authResult = AuthResult(result);
    return authResult;
  } else {
    return AuthResult(tokenResult);
  }
}