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,13 +154,19 @@ class _UpdateDialogState extends State<UpdateDialog> {
updateState = UpdateState.done; updateState = UpdateState.done;
updateResponse = response.body; updateResponse = response.body;
}); });
if (kIsWeb) {
WebUtils.reloadBrowser(); final String message = jsonDecode(response.body)['message'];
if (message.contains('failed')) {
// do nothing
} else { } else {
store.dispatch(RefreshData( if (kIsWeb) {
clearData: true, WebUtils.reloadBrowser();
includeStatic: true, } else {
)); store.dispatch(RefreshData(
clearData: true,
includeStatic: true,
));
}
} }
}).catchError((dynamic error) { }).catchError((dynamic error) {
showErrorDialog(context: context, message: '$error'); showErrorDialog(context: context, message: '$error');