RescheduleAppointment method
Future
RescheduleAppointment(
{ - dynamic order_id,
- dynamic date,
- dynamic time,
})
Implementation
Future RescheduleAppointment({order_id, date, time}) async {
var decodedResponse;
final ApiBody = {
"order_id": "${order_id}",
"date": "${date}",
"time": "${time}"
};
try {
Map data = ApiBody;
var body = jsonEncode(data);
final response = await http.post(
Uri.parse('${WELLNESS_URL}api/diagnostic/reschedule-slot'),
body: body,
headers: {
'Authorization': currentUserToken,
"Content-Type": "application/json"
});
decodedResponse = json.decode(response.body);
if (decodedResponse['success'] == true) {
await testOrderList(1);
Get.back();
diagnostic_order_id = await order_id;
Get.off(DiagnosticsOrderDetails(apiReload: true),
transition: Transition.noTransition, preventDuplicates: false);
Validator().successMessage(
context: commonContext, message: "${decodedResponse['message']}");
} else {
Get.back();
Validator().errorMessage(
context: commonContext, message: "${decodedResponse['message']}");
}
} catch (e) {
print(e);
ErrorListner(
apiname: 'api/diagnostic/reschedule-slot',
responsed: "${decodedResponse}",
request: "",
app_error: '${e}');
}
}