mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 11:36:24 +00:00
Catch POST response which does not return 201
This commit is contained in:
parent
16f4f7195c
commit
d53773d95c
3 changed files with 34 additions and 16 deletions
|
|
@ -242,8 +242,14 @@ class InvenTreeModel {
|
|||
return null;
|
||||
})
|
||||
.then((http.Response response) {
|
||||
var decoded = json.decode(response.body);
|
||||
_model = createFromJson(decoded);
|
||||
// Server should return HTTP_201_CREATED
|
||||
if (response.statusCode == 201) {
|
||||
var decoded = json.decode(response.body);
|
||||
_model = createFromJson(decoded);
|
||||
} else {
|
||||
print("Error creating object: Status Code ${response.statusCode}");
|
||||
print(response.body);
|
||||
}
|
||||
});
|
||||
|
||||
return _model;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue