submitClaimDocumentSubmission method

dynamic submitClaimDocumentSubmission()

Implementation

submitClaimDocumentSubmission() async {
  var checkStatusCode;
  try {
    http.Response response = await http
        .post(Uri.parse('${choice_Base_Url}claim-submission-api'), body: {
      "intimation_id": ClaimSubmissionNumber.toString()
    }, headers: {
      "Authorization": choiceToken,
    });
    TokenRefresh(refreshtoken: response.headers['authorization'].toString());
    checkStatusCode = response.statusCode;

    var decodedResponse = await json.decode(response.body);
    if (decodedResponse['status'] == true) {
      Get.back();
      Navigator.popAndPushNamed(commonContext, '/wellnesspage');
      showDialog(
        context: commonContext,
        barrierDismissible: false,
        builder: (BuildContext context) {
          return ChoiceAlertPopup(
            messag: "${decodedResponse['app_message'] ?? errorMessage}",
            image:
                '${BASE_URL}assets/images/medibhai_images/lottie/Upload_Successful.json',
          );
        },
      );
    } else {
      Fluttertoast.showToast(
          msg: decodedResponse['app_message'] ??
              'Could Not Getting Any Response From API !!!',
          gravity: ToastGravity.CENTER,
          timeInSecForIosWeb: 8);
    }
  } catch (err) {
    AutoLogoutThreeTry();
    if (checkStatusCode == 401) {
      await submitClaimDocumentSubmission();
      (commonContext as Element).reassemble();
    } else {}
  }
}