2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 05:26:47 +00:00

Display HTTP error codes on form errors

This commit is contained in:
Oliver 2021-10-02 22:33:59 +10:00
parent 2f8d02b0be
commit 529510bc5c
2 changed files with 34 additions and 5 deletions

View File

@ -885,7 +885,7 @@ class _APIFormWidgetState extends State<APIFormWidget> {
case 400:
// Form submission / validation error
showSnackIcon(
L10().error,
L10().formError,
success: false
);
@ -894,13 +894,42 @@ class _APIFormWidgetState extends State<APIFormWidget> {
field.data["errors"] = response.data[field.name];
}
break;
case 405:
case 401:
showSnackIcon(
L10().response405,
"401: " + L10().response401,
success: false
);
break;
case 403:
showSnackIcon(
"403: " + L10().response403,
success: false,
);
break;
case 404:
showSnackIcon(
"404: " + L10().response404,
success: false,
);
break;
case 405:
showSnackIcon(
"405: " + L10().response405,
success: false,
);
break;
case 500:
showSnackIcon(
"500: " + L10().response500,
success: false,
);
break;
default:
showSnackIcon(
"${response.statusCode}: " + L10().responseInvalid,
success: false,
);
break;
// TODO: Other status codes?
}
setState(() {

@ -1 +1 @@
Subproject commit bdaf7a516cc40caf6ee1110fea6af073a61d7829
Subproject commit ef5ca26effc8b203a0f49c0fd50afdc8ef2cc3aa