fix : chicken app login and new module logic

This commit is contained in:
2025-08-26 12:22:43 +03:30
parent 8402acbeac
commit e65567ce69
14 changed files with 136 additions and 68 deletions

View File

@@ -1,12 +1,13 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/chicken.dart';
import 'package:rasadyar_chicken/data/common/dio_error_handler.dart';
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
import 'package:rasadyar_chicken/data/models/request/login_request/login_request_model.dart';
import 'package:rasadyar_chicken/data/models/response/user_info/user_info_model.dart';
import 'package:rasadyar_chicken/data/models/response/user_profile_model/user_profile_model.dart';
import 'package:rasadyar_chicken/data/repositories/auth/auth_repository_imp.dart';
import 'package:rasadyar_chicken/data/repositories/auth/auth_repository.dart';
import 'package:rasadyar_chicken/presentation/widget/captcha/logic.dart';
import 'package:rasadyar_core/core.dart';
@@ -44,7 +45,7 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
RxInt secondsRemaining = 120.obs;
Timer? _timer;
AuthRepositoryImpl authRepository = diChicken.get<AuthRepositoryImpl>();
AuthRepository authRepository = diChicken.get<AuthRepository>(instanceName: 'oldRepo');
final Module _module = Get.arguments;
@@ -64,7 +65,6 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
@override
void onReady() {
super.onReady();
}
@override
@@ -118,7 +118,7 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
Future<void> submitLoginForm() async {
if (!_isFormValid()) return;
AuthRepositoryImpl authTmp = diChicken.get<AuthRepositoryImpl>(instanceName: 'newUrl');
AuthRepository authTmp = diChicken.get<AuthRepository>(instanceName: 'newRepo');
isLoading.value = true;
await safeCall<UserProfileModel?>(
call: () => authTmp.login(
@@ -131,6 +131,7 @@ class AuthLogic extends GetxController with GetTickerProviderStateMixin {
await tokenStorageService.saveModule(_module);
await tokenStorageService.saveAccessToken(result?.accessToken ?? '');
await tokenStorageService.saveRefreshToken(result?.accessToken ?? '');
Get.offAndToNamed(ChickenRoutes.init);
},
onError: (error, stackTrace) {
if (error is DioException) {