mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 05:26:47 +00:00
Clear errors once fixed
This commit is contained in:
parent
e9fa0f5eb4
commit
6ff99b15c3
@ -181,9 +181,11 @@ class APIFormField {
|
|||||||
// Extract error messages from the server response
|
// Extract error messages from the server response
|
||||||
void extractErrorMessages(APIResponse response) {
|
void extractErrorMessages(APIResponse response) {
|
||||||
|
|
||||||
|
dynamic errors = null;
|
||||||
|
|
||||||
if (isSimple) {
|
if (isSimple) {
|
||||||
// Simple fields are easily handled
|
// Simple fields are easily handled
|
||||||
data["errors"] = response.data[name];
|
errors = response.data[name];
|
||||||
} else {
|
} else {
|
||||||
if (parent.isNotEmpty) {
|
if (parent.isNotEmpty) {
|
||||||
dynamic parentElement = response.data[parent];
|
dynamic parentElement = response.data[parent];
|
||||||
@ -194,10 +196,12 @@ class APIFormField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (parentElement is Map) {
|
if (parentElement is Map) {
|
||||||
data["errors"] = parentElement[name];
|
errors = parentElement[name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data["errors"] = errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the error message associated with this field
|
// Return the error message associated with this field
|
||||||
|
Loading…
x
Reference in New Issue
Block a user