Manage Beneficiary

This commit is contained in:
2025-08-08 15:43:08 +05:30
parent 117e2d5786
commit 763c101f58
6 changed files with 83 additions and 21 deletions

View File

@@ -103,20 +103,20 @@ class BeneficiaryService {
return false;
}
Future<List<dynamic>> fetchBeneficiaryList() async {
Future<List<Beneficiary>> fetchBeneficiaryList() async{
try {
final response = await _dio.get(
"/api/beneficiaries/get", // replace with actual path
options: Options(
"/api/beneficiary/get",
options: Options(
headers: {
"Content-Type": "application/json",
},
),
);
if (response.statusCode == 200) {
// Assuming API returns JSON array of beneficiaries
return response.data as List<dynamic>;
return Beneficiary.listFromJson(response.data);
} else {
throw Exception("Failed to fetch beneficiaries");
}