mirror of
https://github.com/inventree/inventree-app.git
synced 2025-06-17 04:35:26 +00:00
Part detail view is now refreshabel
- lso add a progress dialog when reloading a model object
This commit is contained in:
@ -89,9 +89,30 @@ class InvenTreeModel {
|
||||
/*
|
||||
* Reload this object, by requesting data from the server
|
||||
*/
|
||||
Future<bool> reload() async {
|
||||
Future<bool> reload(BuildContext context) async {
|
||||
|
||||
var response = await api.get(url, params: defaultGetFilters());
|
||||
showProgressDialog(context, "Refreshing data", "Refreshing data for ${NAME}");
|
||||
|
||||
var response = await api.get(url, params: defaultGetFilters())
|
||||
.timeout(Duration(seconds: 10))
|
||||
.catchError((e) {
|
||||
|
||||
hideProgressDialog(context);
|
||||
|
||||
if (e is TimeoutException) {
|
||||
showErrorDialog(context, "Timeout", "No response from server");
|
||||
} else {
|
||||
showErrorDialog(context, "Error", e.toString());
|
||||
}
|
||||
|
||||
return null;
|
||||
});
|
||||
|
||||
if (response == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
hideProgressDialog(context);
|
||||
|
||||
if (response.statusCode != 200) {
|
||||
print("Error retrieving data");
|
||||
|
Reference in New Issue
Block a user