Message hides after update fails

This commit is contained in:
Hillel Coren 2021-04-06 21:33:25 +03:00
parent d2d674003d
commit c15f4c3f79
1 changed files with 12 additions and 6 deletions

View File

@ -154,6 +154,11 @@ class _UpdateDialogState extends State<UpdateDialog> {
updateState = UpdateState.done; updateState = UpdateState.done;
updateResponse = response.body; updateResponse = response.body;
}); });
final String message = jsonDecode(response.body)['message'];
if (message.contains('failed')) {
// do nothing
} else {
if (kIsWeb) { if (kIsWeb) {
WebUtils.reloadBrowser(); WebUtils.reloadBrowser();
} else { } else {
@ -162,6 +167,7 @@ class _UpdateDialogState extends State<UpdateDialog> {
includeStatic: true, includeStatic: true,
)); ));
} }
}
}).catchError((dynamic error) { }).catchError((dynamic error) {
showErrorDialog(context: context, message: '$error'); showErrorDialog(context: context, message: '$error');
setState(() => updateState = UpdateState.initial); setState(() => updateState = UpdateState.initial);