fix: twice exception onLogin
This commit is contained in:
parent
6cd090f361
commit
c6840638c7
|
@ -18,14 +18,15 @@ import '../../utils/log_util.dart';
|
|||
|
||||
class AuthenticationService {
|
||||
static Future<void> login(BuildContext context) async {
|
||||
try {
|
||||
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
||||
|
||||
final response = await callback.call();
|
||||
|
||||
if (response.jsonBody['error']) {
|
||||
await DialogUtil.errorDefault(context);
|
||||
return;
|
||||
}
|
||||
|
||||
List<dynamic> locals = response.jsonBody['locais'] ?? [];
|
||||
|
||||
if (locals.isEmpty) {
|
||||
|
@ -35,8 +36,10 @@ class AuthenticationService {
|
|||
await StorageHelper().set(SecureStorageKey.isLogged.value, true);
|
||||
context.go('/homePage', extra: {'update': LocalsRepositoryImpl().update});
|
||||
}
|
||||
|
||||
|
||||
} catch (e, s) {
|
||||
await DialogUtil.errorDefault(context);
|
||||
LogUtil.requestAPIFailed('getLocals.php', '', "Get Locals", e, s);
|
||||
}
|
||||
}
|
||||
|
||||
static Future signIn(
|
||||
|
@ -86,7 +89,6 @@ class AuthenticationService {
|
|||
await DialogUtil.errorDefault(context);
|
||||
} else {
|
||||
await DialogUtil.error(context, response.jsonBody['error_msg'].toString());
|
||||
await DialogUtil.error(context, response.jsonBody['error_msg'].toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue