feat: Add initial Flutter Android project setup, core API client with authentication token management, and authentication service.

This commit is contained in:
Michael committed 2025-12-09 17:20:28 +01:00
1 parent ab6c7f585f
commit 664e89f2b8
3 files changed
+29 -21

No files matched your search

+5 -5
View File
@@ -19,7 +19,7 @@ class AuthApiService {
final token = data['token'] as String;
final userData = data['user'] as Map<String, dynamic>;
_api.setToken(token);
await _api.setToken(token);
return AuthResult(
success: true,
@@ -51,15 +51,15 @@ class AuthApiService {
try {
await _api.post('/api/auth/logout');
} finally {
_api.clearToken();
await _api.clearToken();
}
}
/// Get current user from token
Future<AppUser?> getCurrentUser() async {
_api.restoreToken();
await _api.restoreToken();
if (_api.getStoredToken() == null) {
if (_api.getToken() == null) {
return null;
}
@@ -76,7 +76,7 @@ class AuthApiService {
createdAt: DateTime.now(),
);
} catch (e) {
_api.clearToken();
await _api.clearToken();
return null;
}
}