2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-12 02:05:29 +00:00

Display error message when form submission returns error

This commit is contained in:
Oliver
2021-08-15 13:44:27 +10:00
parent cae6dd412c
commit 81602512a5
4 changed files with 13 additions and 5 deletions

View File

@ -597,12 +597,14 @@ class _APIFormWidgetState extends State<APIFormWidget> {
if (method == "POST") {
return await InvenTreeAPI().post(
url,
body: data
body: data,
expectedStatusCode: null
);
} else {
return await InvenTreeAPI().patch(
url,
body: data,
expectedStatusCode: null
);
}
@ -660,6 +662,10 @@ class _APIFormWidgetState extends State<APIFormWidget> {
return;
case 400:
// Form submission / validation error
showSnackIcon(
L10().error,
success: false
);
// Update field errors
for (var field in fields) {