mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 05:26:47 +00:00
Record InvenTree server version in the API
This commit is contained in:
parent
cd4731833d
commit
8450d0cb22
15
lib/api.dart
15
lib/api.dart
@ -72,6 +72,12 @@ class InvenTreeAPI {
|
||||
// Authentication token (initially empty, must be requested)
|
||||
String _token = "";
|
||||
|
||||
// Server version information
|
||||
String _version;
|
||||
|
||||
// Getter for server version information
|
||||
String get version => _version;
|
||||
|
||||
// Connection status flag - set once connection has been validated
|
||||
bool _connected = false;
|
||||
|
||||
@ -86,13 +92,6 @@ class InvenTreeAPI {
|
||||
|
||||
InvenTreeAPI._internal();
|
||||
|
||||
void disconnected() {
|
||||
_connected = false;
|
||||
|
||||
// Clear token
|
||||
_token = "";
|
||||
}
|
||||
|
||||
Future<bool> connect() async {
|
||||
|
||||
var prefs = await SharedPreferences.getInstance();
|
||||
@ -173,6 +172,8 @@ class InvenTreeAPI {
|
||||
print("Server: " + data["server"]);
|
||||
print("Version: " + data["version"]);
|
||||
|
||||
_version = data["version"];
|
||||
|
||||
// Request token from the server if we do not already have one
|
||||
if (_token.isNotEmpty) {
|
||||
print("Already have token - $_token");
|
||||
|
Loading…
x
Reference in New Issue
Block a user