Save the token to the right variable

This commit is contained in:
Roland Geider
2025-05-01 13:12:46 +02:00
parent ad1c286fe7
commit f812910bdf

View File

@@ -147,8 +147,6 @@ class AuthProvider with ChangeNotifier {
) async {
await logout(shouldNotify: false);
String token;
// Login using the API token
if (apiToken != null && apiToken.isNotEmpty) {
final response = await client.get(
@@ -165,7 +163,6 @@ class AuthProvider with ChangeNotifier {
}
token = apiToken;
state = AuthState.loggedIn;
// Login using password
} else {
@@ -184,7 +181,6 @@ class AuthProvider with ChangeNotifier {
}
token = responseData['token'];
state = AuthState.loggedIn;
}
await initVersions(serverUrl);
@@ -196,6 +192,7 @@ class AuthProvider with ChangeNotifier {
}
// Log user in
state = AuthState.loggedIn;
notifyListeners();
// store login data in shared preferences