Add full app source
Adds the Flutter inventory app source, cleaned up for a shared repo: generic package name, no hardcoded ERP endpoints (moved to gitignored local config), no dead auth code, no debug logging of session data.
This commit is contained in:
25
lib/controllers/user_controller.dart
Normal file
25
lib/controllers/user_controller.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:inventory_app/service/axelor_client.dart';
|
||||
|
||||
class UserController extends GetxController {
|
||||
var isLoading = false.obs;
|
||||
var user = Rx<Map<String, dynamic>?>(null);
|
||||
|
||||
Future<void> loadUser() async {
|
||||
try {
|
||||
isLoading.value = true;
|
||||
final client = await AxelorClient.create();
|
||||
final profile = await client.fetchUserProfile();
|
||||
user.value = profile;
|
||||
} catch (e) {
|
||||
print("❌ Failed to load user: $e");
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Optional: clear user when logging out
|
||||
void clearUser() {
|
||||
user.value = null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user