medicineReOrder method

dynamic medicineReOrder({
  1. dynamic medicineOrderId,
  2. dynamic context,
})

Implementation

medicineReOrder({medicineOrderId, context}) async {
  var decodedResponse;
  final ApiBody = {
    "medicine_order_id": '$medicineOrderId',
  };
  var body = jsonEncode(ApiBody);

  http.Response response = await http.post(
      Uri.parse('${medicine_API}api/medicine/medicine-reorder-api'),
      headers: {
        "Content-Type": "application/json",
        'Authorization': currentUserToken,
      },
      body: body);
  decodedResponse = json.decode(response.body);
  Get.back();

  if (decodedResponse['success'] == true) {
    Validator().successMessage(
        context: context, message: decodedResponse['message']);
    Get.to(MedicineCartPage());
  } else {
    Validator().errorMessage(
        context: context, message: "${decodedResponse['message']}");
  }
}