Untitled

 avatar
unknown
dart
a year ago
1.2 kB
0
Indexable
 void registerApp() async {
    _dialogsUtils.showLoading();
    String fullName = "";
    if (fullNameTEC.text != "") {
      fullName = fullNameTEC.text;
    } else {
      fullName = "Qoin-${phoneTEC.text}";
    }
    final result = await QoinSaasSdk.accessUser.userRegisterUsingPhonePin.call(
      fullName: fullName,
      phone: phoneTEC.text,
      pin: pinTEC.text,
      pinConfirmation: confirmPinTEC.text,
      type: type.value,
      latitude: -6.163954,
      longitude: 106.781701,
    );
    result.when(
      userListed: () {
        _dialogsUtils.hideLoading();
        Get.offNamed(Routes.LOGIN);
      },
      userUnListed: (data) {
        _dialogsUtils.hideLoading();
        Get.offNamed(
          Routes.VALIDATE_OTP,
          arguments: ValidateOtpArgs(
            phone: phoneTEC.text,
            otpKey: data.otpKey,
            resendOtpKey: data.resendKey,
            validationType: ValidationOtpType.SEND,
            validationCase: ValidationOtpCase.REGISTER,
            data: const ValidateOtpArgsData.newRequest(),
          ),
        );
      },
      error: (message) {
        _dialogsUtils.hideLoading();
        error.value = message;
      },
    );
  }