FIX: resolvendo a logica de validação do localization_service
This commit is contained in:
parent
43ff7cf5c8
commit
a63a9d3f30
|
@ -22,8 +22,9 @@ class LocalizationService {
|
|||
final GetLocalsCall callback = PhpGroup.getLocalsCall;
|
||||
|
||||
var response = await callback.call();
|
||||
final bool isError = response.jsonBody['error'];
|
||||
|
||||
if (response.jsonBody['error'] == false) {
|
||||
if (isError) {
|
||||
final List<dynamic> locals = response.jsonBody['locais'] ?? [];
|
||||
final bool isEmpty = locals.isEmpty;
|
||||
final bool isActive = locals
|
||||
|
@ -41,10 +42,10 @@ class LocalizationService {
|
|||
StorageUtil().context?.go('/homePage');
|
||||
}
|
||||
} else {
|
||||
final bool isInvalid = response.jsonBody['error_msg'] == 'Esse dispositivo nao pertence a esse usuario';
|
||||
if(isInvalid) StorageUtil().isLogged = false;
|
||||
if(isInvalid) context.go('/welcomePage');
|
||||
return DialogUtil.error(context, response.jsonBody['error_msg']);
|
||||
final String content = response.jsonBody['error_msg'];
|
||||
if(isError) StorageUtil().isLogged = false;
|
||||
if(isError) context.go('/welcomePage');
|
||||
return DialogUtil.error(context, content);
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,19 +61,22 @@ class LocalizationService {
|
|||
final ApiCallResponse response = await callback.call();
|
||||
|
||||
|
||||
final bool isError = response.jsonBody['error'] == true;
|
||||
final bool isInvalid = response.jsonBody['error_msg'] == 'Esse dispositivo nao pertence a esse usuario';
|
||||
final bool isError = response.jsonBody['error'];
|
||||
final String content = response.jsonBody['error_msg'];
|
||||
|
||||
if(isError) StorageUtil().isLogged = false;
|
||||
if(isError) context.go('/welcomePage');
|
||||
if(isError) DialogUtil.error(context, response.jsonBody['error_msg']);
|
||||
if(isError) return false;
|
||||
|
||||
|
||||
if(isInvalid) StorageUtil().isLogged = false;
|
||||
if(isInvalid) context.go('/welcomePage');
|
||||
final List<dynamic> locals = response.jsonBody['locais'].toList() ?? [];
|
||||
for (var local in locals) {
|
||||
final String status = local['CLU_STATUS'];
|
||||
log('() => CLU_STATUS: $status');
|
||||
}
|
||||
|
||||
if(isError) DialogUtil.error(context, response.jsonBody['error_msg']);
|
||||
if(isError) return false;
|
||||
|
||||
|
||||
final bool isActive = locals.where((local) => local['CLU_STATUS'] == 'A').toList().isNotEmpty;
|
||||
final bool isInactived = locals.where((local) => local['CLI_ID'] != StorageUtil().cliUUID && local['CLU_STATUS'] == 'A').toList().isNotEmpty;
|
||||
|
|
Loading…
Reference in New Issue