Manage Beneficiary
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
Reference in New Issue
Block a user