2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-12 02:05:29 +00:00

API refactoring:

- Error if the server version is *older* than the min required version
- Display dialog boxes for different server errors
This commit is contained in:
Oliver Walters
2021-02-02 20:37:54 +11:00
parent cfb3dd6506
commit b69762ff15
8 changed files with 133 additions and 76 deletions

View File

@ -25,7 +25,6 @@ class InvenTreeHomePage extends StatefulWidget {
class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
_InvenTreeHomePageState() : super() {
_checkServerConnection();
}
String _serverAddress = "";
@ -63,7 +62,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
/*
* Test the server connection
*/
void _checkServerConnection() async {
void _checkServerConnection(BuildContext context) async {
var prefs = await SharedPreferences.getInstance();
@ -76,7 +75,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
_serverIcon = new FaIcon(FontAwesomeIcons.spinner);
_serverStatusColor = Color.fromARGB(255, 50, 50, 250);
InvenTreeAPI().connect().then((bool result) {
InvenTreeAPI().connect(context).then((bool result) {
if (result) {
onConnectSuccess("");
@ -322,7 +321,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
leading: _serverIcon,
onTap: () {
if (!_serverConnection) {
_checkServerConnection();
_checkServerConnection(context);
}
},
),