Небольшие исправления
This commit is contained in:
@@ -48,7 +48,7 @@ class _RegistrationScreenState extends BaseState<RegistrationScreen> {
|
||||
return textFieldValue.length > 0 && textFieldValue.length < 25;
|
||||
}
|
||||
|
||||
/// Показать индикатор, запросить токен.
|
||||
/// Показать progressBar, запросить токен.
|
||||
_registerShop(BuildContext context) {
|
||||
setState(() {
|
||||
loading = true;
|
||||
@@ -56,14 +56,6 @@ class _RegistrationScreenState extends BaseState<RegistrationScreen> {
|
||||
});
|
||||
}
|
||||
|
||||
/// Экран зависает на 1 сек, после этого выполняется переход на экран потверждения токена.
|
||||
_registerDemo(BuildContext context) {
|
||||
new Future.delayed(const Duration(milliseconds: 1000), () {
|
||||
loading = false;
|
||||
pushRoute(context, new FinishRegistrationScreen());
|
||||
});
|
||||
}
|
||||
|
||||
/// Получение от платформы id установки, формирование запроса на получение токена, сохранение токена.
|
||||
_register(BuildContext context) async {
|
||||
|
||||
@@ -76,33 +68,27 @@ class _RegistrationScreenState extends BaseState<RegistrationScreen> {
|
||||
'pos': pos,
|
||||
};
|
||||
|
||||
pushRoute(context, new FinishRegistrationScreen());
|
||||
|
||||
// httpClient.post(url, body: body).then((response) {
|
||||
httpClient.post(url, body: body).then((response) {
|
||||
|
||||
setState(() {
|
||||
error = null;
|
||||
loading = false;
|
||||
});
|
||||
|
||||
// print(response.body);
|
||||
// Map parsedMap = JSON.decode(response.body);
|
||||
// setState(() {
|
||||
// loading = false;
|
||||
// });
|
||||
// if (response.statusCode == 201) {
|
||||
// token = parsedMap['token'];
|
||||
// platform.invokeMethod('saveToken', {'token' : token});
|
||||
// platform.invokeMethod('saveMerchantID', {'merchantID' : merchantID});
|
||||
// pushRoute(context, new FinishRegistrationScreen());
|
||||
// } else {
|
||||
// setState(() {
|
||||
// error = parsedMap['errors'][0];
|
||||
// });
|
||||
// }
|
||||
// }).catchError((error) {
|
||||
// setState(() {
|
||||
// error = 'Отсутствует интернет соединение';
|
||||
// });
|
||||
// });
|
||||
print(response.body);
|
||||
Map parsedMap = JSON.decode(response.body);
|
||||
if (response.statusCode == 201) {
|
||||
token = parsedMap['token'];
|
||||
platform.invokeMethod('saveToken', {'token' : token});
|
||||
platform.invokeMethod('saveMerchantID', {'merchantID' : textFieldValue});
|
||||
pushRoute(context, new FinishRegistrationScreen());
|
||||
} else {
|
||||
setState(() {
|
||||
error = parsedMap['errors'][0];
|
||||
});
|
||||
}
|
||||
}).catchError((error) {
|
||||
print(error.toString());
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user