2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-13 18:55:34 +00:00

API forms return the JSON data to the onSuccess function

This commit is contained in:
Oliver
2021-08-10 14:33:08 +10:00
parent 67ccbf64b5
commit 6d0282519d
9 changed files with 107 additions and 31 deletions

View File

@ -67,7 +67,13 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
return;
}
_cat.editForm(context, L10().editCategory, onSuccess: refresh);
_cat.editForm(
context,
L10().editCategory,
onSuccess: (data) async {
refresh();
}
);
}
_CategoryDisplayState(this.category);
@ -211,14 +217,27 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
int pk = category?.pk ?? -1;
launchApiForm(
context,
L10().categoryCreate,
InvenTreePartCategory().URL,
InvenTreePartCategory().formFields(),
modelData: {
"parent": (pk > 0) ? pk : null,
InvenTreePartCategory().createForm(
context,
L10().categoryCreate,
data: {
"parent": (pk > 0) ? pk : null,
},
onSuccess: (data) async {
if (data.containsKey("pk")) {
var new_cat = InvenTreePartCategory.fromJson(data);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CategoryDisplayWidget(new_cat)
)
);
} else {
refresh();
}
}
);
}

View File

@ -79,7 +79,9 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
"currency": {},
},
modelData: company.jsondata,
onSuccess: refresh
onSuccess: (data) async {
refresh();
}
);
}

View File

@ -94,7 +94,9 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
"parent": {},
},
modelData: _loc.jsondata,
onSuccess: refresh
onSuccess: (data) async {
refresh();
}
);
}

View File

@ -126,7 +126,9 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
"virtual": {},
},
modelData: part.jsondata,
onSuccess: refresh,
onSuccess: (data) async {
refresh();
},
);
}

View File

@ -56,7 +56,7 @@ class _PartNotesState extends RefreshableState<PartNotesWidget> {
}
},
modelData: part.jsondata,
onSuccess: () async {
onSuccess: (data) async {
refresh();
}
);

View File

@ -120,7 +120,9 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
"link": {},
},
modelData: item.jsondata,
onSuccess: refresh
onSuccess: (data) async {
refresh();
}
);
}

View File

@ -56,7 +56,7 @@ class _StockNotesState extends RefreshableState<StockNotesWidget> {
}
},
modelData: item.jsondata,
onSuccess: () {
onSuccess: (data) async {
refresh();
}
);