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.
26 lines
633 B
Dart
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;
|
|
}
|
|
}
|