feat : captcha widget.dart
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
enum ApiEnvironment {
|
||||
dam(url: 'https://api.dam.rasadyar.net');
|
||||
dam(url: 'https://api.dam.rasadyar.net/');
|
||||
|
||||
const ApiEnvironment({required this.url});
|
||||
|
||||
|
||||
@@ -8,9 +8,12 @@ class DioRemoteManager {
|
||||
DioRemote? _currentClient;
|
||||
ApiEnvironment? _currentEnv;
|
||||
|
||||
DioRemote setEnvironment(ApiEnvironment env) {
|
||||
Future<DioRemote> setEnvironment([
|
||||
ApiEnvironment env = ApiEnvironment.dam,
|
||||
]) async {
|
||||
if (_currentEnv != env) {
|
||||
_currentClient = DioRemote(env.baseUrl);
|
||||
await _currentClient?.init();
|
||||
_currentEnv = env;
|
||||
}
|
||||
return _currentClient!;
|
||||
@@ -30,10 +33,10 @@ class DioRemoteManager {
|
||||
Future<void> switchAuthEnvironment(ApiEnvironment env) async {
|
||||
final manager = diAuth.get<DioRemoteManager>();
|
||||
|
||||
final dioRemote = manager.setEnvironment(env);
|
||||
final dioRemote = await manager.setEnvironment(env);
|
||||
|
||||
if (diAuth.isRegistered<AuthRepositoryImpl>()) {
|
||||
await diAuth.unregister<AuthRepositoryImpl>();
|
||||
await diAuth.unregister<AuthRepositoryImpl>();
|
||||
}
|
||||
|
||||
diAuth.registerLazySingleton<AuthRepositoryImpl>(
|
||||
|
||||
Reference in New Issue
Block a user