shopifySendEmailVerificationCode static method

Future<Result> shopifySendEmailVerificationCode(
  1. String email
)

Implementation

static Future<Result> shopifySendEmailVerificationCode(
  String email,
) async {
  try {
    final gokwik = DioClient().getClient();

    final phoneNumber = await ApiService.getUserPhone();
    if (phoneNumber != null) {
      await SnowplowTrackerService.sendCustomEventToSnowPlow({
        'category': 'login_modal',
        'label': 'email_filled',
        'action': 'click',
        'property': 'phone_number',
        'value': phoneNumber,
      });
    }

    final response = (await gokwik.post(
      cdnConfigInstance.getEndpoint(APIEndpointKeys.sendEmailVerificationCode)!,
      data: {'email': email},
    ))
        .toBaseResponse();
    if (response.isSuccess == false) {
      return Failure(response.errorMessage ?? '');
    }


    return Success(response.data);
  } catch (error) {
    throw ApiService.handleApiError(error);
  }
}