From 0c18d96ba2d40d5f6e05ad1e3d7d6e4316e2006e Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 29 Dec 2020 14:37:48 +0200 Subject: [PATCH] post procedure --- lib/client/base_app_client.dart | 14 ++++++-------- lib/config/config.dart | 8 +++++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 015cf0f5..3006662e 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -78,7 +78,7 @@ class BaseAppClient { 'Accept': 'application/json' }); final int statusCode = response.statusCode; - if (statusCode < 200 || statusCode >= 400 ) { + if (statusCode < 200 || statusCode >= 400) { onFailure('Error While Fetching data', statusCode); } else { var parsed = json.decode(response.body.toString()); @@ -89,7 +89,7 @@ class BaseAppClient { // helpers.showErrorToast('Your session expired Please login agian'); // } else if (parsed['MessageStatus'] == 1) { - if(!parsed['IsAuthenticated']) + if (!parsed['IsAuthenticated']) onFailure(getError(parsed), statusCode); else onSuccess(parsed, statusCode); @@ -106,21 +106,19 @@ class BaseAppClient { } } - String getError(parsed){ + String getError(parsed) { //TODO change this fun String error = parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; if (parsed["ValidationErrors"] != null) { - error = parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; if (parsed["ValidationErrors"]["ValidationErrors"] != null && parsed["ValidationErrors"]["ValidationErrors"].length != 0) { for (var i = 0; - i < parsed["ValidationErrors"]["ValidationErrors"].length; - i++) { + i < parsed["ValidationErrors"]["ValidationErrors"].length; + i++) { error = error + - parsed["ValidationErrors"]["ValidationErrors"][i] - ["Messages"][0] + + parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] + "\n"; } } diff --git a/lib/config/config.dart b/lib/config/config.dart index 7f4fea03..d3728ddf 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -120,11 +120,13 @@ const GET_MASTER_LOOKUP_LIST = 'Services/DoctorApplication.svc/REST/GetMasterLookUpList'; const POST_ALLERGY = 'Services/DoctorApplication.svc/REST/PostAllergies'; const POST_HISTORY = 'Services/DoctorApplication.svc/REST/PostHistory'; -const POST_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; -const POST_PHYSICAL_EXAM = 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; -const POST_PROGRESS_NOTE = '/Services/DoctorApplication.svc/REST/PostProgressNote'; const POST_CHIEF_COMPLAINT = 'Services/DoctorApplication.svc/REST/PostChiefcomplaint'; +const POST_PHYSICAL_EXAM = + 'Services/DoctorApplication.svc/REST/PostPhysicalExam'; +const POST_PROGRESS_NOTE = + '/Services/DoctorApplication.svc/REST/PostProgressNote'; + const GET_CATEGORISE_PROCEDURE = 'Services/DoctorApplication.svc/REST/GetCategories';