refactor(app): Assemble release

This commit is contained in:
2024-04-11 16:24:10 +03:00
parent bbbc20a15a
commit 5122665370
5 changed files with 45 additions and 20 deletions

View File

@@ -76,16 +76,18 @@ class AdditionalInformationScreen extends StatelessWidget {
UserRegistrationSheet sheet =
state.additionalInformationModelObj!.userRegistrationSheet;
sheet.additionalInfo = state.editTextController!.text;
//print(json.encode(sheet.toJson()));
final response = await http.post(
Uri.parse(dotenv.env['SERVER_ROOT']! + '/register'),
headers: {'Content-Type': 'application/json'},
body: jsonEncode(sheet),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: jsonEncode(sheet.toJson()),
encoding: utf8);
print(jsonEncode(sheet.toJson()));
print(Uri.parse(dotenv.env['SERVER_ROOT']! + '/register'));
var res = await jsonDecode(response.body);
if (response.statusCode == 200) {
var res = await jsonDecode(response.body);
final box = await Hive.openBox('token');
final token = res['token'];
box.put('token', token);
@@ -93,6 +95,8 @@ class AdditionalInformationScreen extends StatelessWidget {
context,
AppRoutes.myProfile,
);
} else {
showErrorMessage(context, res['message']);
}
};
}
@@ -152,12 +156,12 @@ class AdditionalInformationScreen extends StatelessWidget {
/// Displays an alert dialog when the action is triggered.
/// The dialog box contains a title and a message with the `Теперь вы можете пользоваться полным функционалом приложения`
showSuccessMessage(BuildContext context, String text) {
showErrorMessage(BuildContext context, String text) {
showDialog(
context: context,
builder: (_) => AlertDialog(
title: const Text('Регистрация завершена!'),
content: const Text('1'),
title: const Text('Ошибка'),
content: Text(text),
actions: [
TextButton(onPressed: onTapOk(context), child: const Text('Ok'))
],