resendChangeEmailCode method

  1. @override
Future<Either<Failure, Unit>> resendChangeEmailCode(
  1. AuthenticationData authData, {
  2. Map<String, dynamic>? additionalParams,
})
override

Implementation

@override
Future<Either<Failure, Unit>> resendChangeEmailCode(AuthenticationData authData,
    {Map<String, dynamic>? additionalParams}) async {
  return wrapAndHandleHttpBaseRequest<Unit>(
    () {
      if (config.resendChangeEmailCodeApiEndpoint == null) {
        throw Exception(
            "'resendChangeEmailCodeApiEndpoint' property is not defined in provided AccountBasicConfig");
      }

      final Uri uri = config.resendChangeEmailCodeApiEndpoint!(authData);

      final body = config.resendChangeEmailCodeCustomRequestMapper?.call(additionalParams) ??
          jsonEncode({});

      // final response = await client.patch(
      //   uri,
      //   body: body,
      // );
      return http.Request(config.resendChangeEmailCodeApiMethod ?? "PATCH", uri)..body = body;
    },
    onResponse: (response, left, right) {
      config.resendChangeEmailCodeCustomResponseParser?.call(
        response,
      );
      return right(unit);
    },
  );
}