Files
ERP-APP-INVENTORY/lib/controllers/user_controller.dart
BACHIR SOULDI 5a483da01d 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.
2026-07-16 14:37:28 +01:00

26 lines
633 B
Dart

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;
}
}