getEscalationMatrix method

Future getEscalationMatrix({
  1. dynamic policyTypeId,
})

Implementation

Future getEscalationMatrix({policyTypeId}) async {
  var checkStatusCode;

  try {
    var decodedResponse;
    final response = await http.get(
        Uri.parse(
            '${choice_Base_Url}escalation-matrix-list?policy_type_id=${policyTypeId}'),
        headers: {"Authorization": choiceToken});
    TokenRefresh(refreshtoken: response.headers['authorization'].toString());
    checkStatusCode = response.statusCode;
    decodedResponse = json.decode(response.body);
    if (response.statusCode == 200) {
      escalationMatrixList = decodedResponse['data'];
    } else {
      getErrorMessage(decodedResponse['message']);
      Get.back();
    }
  } catch (err) {
    AutoLogoutThreeTry();
    if (checkStatusCode == 401) {
      await getEscalationMatrix(policyTypeId: policyTypeId);
      (commonContext as Element).reassemble();
    } else {}
  }
}