DeleteMember method
Future
DeleteMember(
{ - dynamic member_id,
- dynamic context,
})
Implementation
Future DeleteMember({member_id, context}) async {
var decodedResponse;
final ApiBody = {"member_id": "${member_id}"};
try {
Map data = ApiBody;
var body = jsonEncode(data);
final response = await http.post(
Uri.parse('${WELLNESS_URL}api/diagnostic/delete-members'),
headers: {
'Authorization': currentUserToken,
"Content-Type": "application/json"
},
body: body,
);
decodedResponse = json.decode(response.body);
if (decodedResponse['success'] == true) {
return null;
} else {
showDialog(
barrierDismissible: false,
context: context,
builder: (BuildContext context) {
return PinCodePopUp(
messag: "${decodedResponse['message']}",
image: '${LottiePath}Error.json',
);
},
);
}
} catch (e) {
ErrorListner(
apiname: 'api/diagnostic/delete-members',
responsed: "${decodedResponse}",
request: "${ApiBody}",
app_error: '${e}');
}
}