feat : login api call
This commit is contained in:
@@ -6,7 +6,8 @@ import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class CaptchaWidgetLogic extends GetxController
|
||||
with StateMixin<CaptchaResponseModel> {
|
||||
TextEditingController textController = TextEditingController();
|
||||
Rx<TextEditingController> textController = TextEditingController().obs;
|
||||
RxnString captchaKey = RxnString();
|
||||
GlobalKey<FormState> formKey = GlobalKey<FormState>();
|
||||
AuthRepositoryImpl authRepository = diAuth.get<AuthRepositoryImpl>();
|
||||
|
||||
@@ -17,17 +18,19 @@ class CaptchaWidgetLogic extends GetxController
|
||||
getCaptcha();
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
textController.value.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
Future<void> getCaptcha() async {
|
||||
change(null, status: RxStatus.loading());
|
||||
textController.value.clear();
|
||||
safeCall(
|
||||
call: () async => await authRepository.captcha(),
|
||||
onSuccess: (value) {
|
||||
captchaKey.value = value?.captchaKey;
|
||||
change(value, status: RxStatus.success());
|
||||
},
|
||||
onError: (error, stackTrace) {
|
||||
|
||||
Reference in New Issue
Block a user