2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-17 04:35:26 +00:00

Updated PATCH request

This commit is contained in:
Oliver Walters
2021-04-19 22:15:47 +10:00
parent 432558678d
commit fa1256d858
3 changed files with 67 additions and 51 deletions

View File

@ -186,34 +186,15 @@ class InvenTreeModel {
addr += "/";
}
var response = await api.patch(addr, body: values)
.timeout(Duration(seconds: 10))
.catchError((e) {
if (e is SocketException) {
showServerError(
I18N.of(context).connectionRefused,
e.toString()
);
} else if (e is TimeoutException) {
showTimeoutError(context);
} else {
// Re-throw the error
throw e;
}
return null;
});
var response = await api.patch(
addr,
body: values,
expectedStatusCode: 200
);
if (response == null) return false;
if (response.statusCode != 200) {
showStatusCodeError(response.statusCode);
return false;
}
return true;
}
// Return the detail view for the associated pk