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

Returning object list now works correctly (and asynchronously!)

This commit is contained in:
Oliver Walters 2020-03-31 23:38:24 +11:00
parent 0ee1dedd45
commit c06dd9d999

View File

@ -62,12 +62,16 @@ class InvenTreeObject {
// TODO - Add "timeout"
// TODO - Add error catching
InvenTreeAPI().get(_URL, params:filters).then((http.Response response) {
var response = await InvenTreeAPI().get(_URL, params:filters);
// A list of "InvenTreeObject" items
List<InvenTreeObject> results = new List<InvenTreeObject>();
if (response.statusCode != 200) {
print("Error retreiving data");
return results;
}
final data = json.decode(response.body);
for (var d in data) {
@ -81,10 +85,7 @@ class InvenTreeObject {
}
}
return results;
});
}