2025-05-14 11:44:46 +03:30
|
|
|
import 'package:rasadyar_auth/data/common/constant.dart';
|
2025-05-17 15:24:06 +03:30
|
|
|
import 'package:rasadyar_auth/data/common/dio_error_handler.dart';
|
2025-05-14 11:44:46 +03:30
|
|
|
import 'package:rasadyar_auth/data/repositories/auth_repository_imp.dart';
|
2025-05-14 09:42:44 +03:30
|
|
|
import 'package:rasadyar_core/core.dart';
|
|
|
|
|
|
|
|
|
|
import '../common/dio_manager.dart';
|
|
|
|
|
|
|
|
|
|
GetIt diAuth = GetIt.instance;
|
|
|
|
|
|
|
|
|
|
Future<void> setupAuthDI() async {
|
|
|
|
|
diAuth.registerLazySingleton(() => DioRemoteManager());
|
2025-06-03 22:52:21 +03:30
|
|
|
diAuth.registerLazySingleton<DioRemote>(() => DioRemote());
|
2025-05-14 09:42:44 +03:30
|
|
|
|
2025-05-19 16:16:33 +03:30
|
|
|
|
2025-06-03 22:52:21 +03:30
|
|
|
final dioRemote = diAuth.get<DioRemote>();
|
|
|
|
|
await dioRemote.init();
|
2025-06-03 23:57:25 +03:30
|
|
|
diAuth.registerSingleton<AuthRepositoryImpl>(AuthRepositoryImpl(dioRemote));
|
2025-05-17 15:24:06 +03:30
|
|
|
diAuth.registerLazySingleton<DioErrorHandler>(() => DioErrorHandler());
|
2025-05-14 09:42:44 +03:30
|
|
|
}
|
2025-06-03 23:57:25 +03:30
|
|
|
|
|
|
|
|
Future<void> newSetupAuthDI(String newUrl) async {
|
|
|
|
|
diAuth.registerLazySingleton<DioRemote>(() => DioRemote(baseUrl: newUrl),instanceName: 'newRemote');
|
|
|
|
|
final dioRemote = diAuth.get<DioRemote>(instanceName: 'newRemote');
|
|
|
|
|
await dioRemote.init();
|
|
|
|
|
diAuth.registerSingleton<AuthRepositoryImpl>(
|
|
|
|
|
AuthRepositoryImpl(dioRemote),
|
|
|
|
|
instanceName: 'newUrl',
|
|
|
|
|
);
|
|
|
|
|
}
|