mirror of
https://github.com/inventree/inventree-app.git
synced 2025-05-03 07:48:53 +00:00
Stupid async
This commit is contained in:
parent
de4acbe005
commit
16f4f7195c
@ -232,7 +232,9 @@ class InvenTreeModel {
|
|||||||
data.remove('id');
|
data.remove('id');
|
||||||
}
|
}
|
||||||
|
|
||||||
api.post(URL, body: data)
|
InvenTreeModel _model;
|
||||||
|
|
||||||
|
await api.post(URL, body: data)
|
||||||
.timeout(Duration(seconds: 5))
|
.timeout(Duration(seconds: 5))
|
||||||
.catchError((e) {
|
.catchError((e) {
|
||||||
print("Error creating new ${NAME}:");
|
print("Error creating new ${NAME}:");
|
||||||
@ -241,12 +243,10 @@ class InvenTreeModel {
|
|||||||
})
|
})
|
||||||
.then((http.Response response) {
|
.then((http.Response response) {
|
||||||
var decoded = json.decode(response.body);
|
var decoded = json.decode(response.body);
|
||||||
var model = createFromJson(decoded);
|
_model = createFromJson(decoded);
|
||||||
|
|
||||||
return model;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return null;
|
return _model;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return list of objects from the database, with optional filters
|
// Return list of objects from the database, with optional filters
|
||||||
|
@ -144,7 +144,16 @@ class InvenTreeStockItem extends InvenTreeModel {
|
|||||||
data["notes"] = notes;
|
data["notes"] = notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
InvenTreeStockItemTestResult().create(context, data);
|
|
||||||
|
bool _result = false;
|
||||||
|
|
||||||
|
await InvenTreeStockItemTestResult().create(context, data).then((InvenTreeModel model) {
|
||||||
|
|
||||||
|
_result = model != null && model is InvenTreeStockItemTestResult;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
return _result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get partId => jsondata['part'] ?? -1;
|
int get partId => jsondata['part'] ?? -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user