import 'package:cheminova/controller/get_pending_service.dart';
import 'package:cheminova/models/get_rd_pennding_model.dart';
import 'package:get/get.dart';
import 'package:shared_preferences/shared_preferences.dart';

class GetRdPendingController extends GetxController{
  var isLoading = true.obs; // Tracks the loading state
  var productRDList = <GetRdPendingModel>[].obs; // List of products
  Future<void> getRDPendingProduct() async {

    try {
      SharedPreferences prefs = await SharedPreferences.getInstance();
      String? token = prefs.getString('token');
      isLoading(true); // Start loading
      final  response = await GetPendingService().getRDPendingProduct(token!); // Fetch products from API
      if (response != null) {
        productRDList.assignAll(response); // Assign products to the observable list
      }
    } finally {
      isLoading(false); // End loading
    }
  }

}