Manage Beneficiary delete Confirm
This commit is contained in:
@@ -105,17 +105,17 @@ class BeneficiaryService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> deleteBeneficiary(String accountNo) async {
|
Future<void> deleteBeneficiary(String accountNo) async {
|
||||||
try {
|
try {
|
||||||
final response = await _dio.delete('/api/beneficiary/$accountNo');
|
final response = await _dio.delete('/api/beneficiary/$accountNo');
|
||||||
|
|
||||||
if (response.statusCode != 204) {
|
if (response.statusCode != 204) {
|
||||||
throw Exception('Failed to delete beneficiary');
|
throw Exception('Failed to delete beneficiary');
|
||||||
}
|
}
|
||||||
} on DioException catch (e) {
|
} on DioException catch (e) {
|
||||||
throw Exception('Network error: ${e.message}');
|
throw Exception('Network error: ${e.message}');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw Exception('Unexpected error: ${e.toString()}');
|
throw Exception('Unexpected error: ${e.toString()}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -60,7 +60,7 @@ void _showDeleteConfirmationDialog(BuildContext context) {
|
|||||||
TextButton(
|
TextButton(
|
||||||
child: const Text('Delete'),
|
child: const Text('Delete'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
//Navigator.of(context).pop();
|
||||||
_deleteBeneficiary(context);
|
_deleteBeneficiary(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user