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