mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-14 03:56:24 +00:00
Stupid async
This commit is contained in:
parent
de4acbe005
commit
16f4f7195c
2 changed files with 15 additions and 6 deletions
|
|
@ -232,7 +232,9 @@ class InvenTreeModel {
|
|||
data.remove('id');
|
||||
}
|
||||
|
||||
api.post(URL, body: data)
|
||||
InvenTreeModel _model;
|
||||
|
||||
await api.post(URL, body: data)
|
||||
.timeout(Duration(seconds: 5))
|
||||
.catchError((e) {
|
||||
print("Error creating new ${NAME}:");
|
||||
|
|
@ -241,12 +243,10 @@ class InvenTreeModel {
|
|||
})
|
||||
.then((http.Response response) {
|
||||
var decoded = json.decode(response.body);
|
||||
var model = createFromJson(decoded);
|
||||
|
||||
return model;
|
||||
_model = createFromJson(decoded);
|
||||
});
|
||||
|
||||
return null;
|
||||
return _model;
|
||||
}
|
||||
|
||||
// Return list of objects from the database, with optional filters
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue