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 cacheInstance.getValue(KeyConfig.gkUserPhone);

    await SnowplowTrackerService.sendCustomEventToSnowPlow({
      'category': 'login_modal',
      'label': 'email_filled',
      'action': 'click',
      'property': 'email',
      'value': int.tryParse(phoneNumber ?? '0') ?? 0,
    });

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


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