|
|
|
|
@ -10,7 +10,7 @@ class BaseAppClient {
|
|
|
|
|
static post(String endPoint, {Map<String, dynamic>? body, Function(dynamic response, int statusCode)? onSuccess, Function(String error, int statusCode)? onFailure}) async {
|
|
|
|
|
String url;
|
|
|
|
|
|
|
|
|
|
url = "$BASE_URL/api/PatientCall" + endPoint;
|
|
|
|
|
url = "$BASE_URL/api/PatientCall$endPoint";
|
|
|
|
|
|
|
|
|
|
// try {
|
|
|
|
|
logger.i("URL : $url");
|
|
|
|
|
@ -29,7 +29,7 @@ class BaseAppClient {
|
|
|
|
|
onFailure(Utils.generateContactAdminMsg(), statusCode);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
logger.i("Response: ${response.body.toString()}");
|
|
|
|
|
log("Response: ${response.body.toString()}");
|
|
|
|
|
var parsed = json.decode(response.body.toString());
|
|
|
|
|
if (onSuccess != null) {
|
|
|
|
|
onSuccess(parsed, statusCode);
|
|
|
|
|
@ -50,7 +50,7 @@ class BaseAppClient {
|
|
|
|
|
static get(String endPoint, {Map<String, dynamic>? body, Function(dynamic response, int statusCode)? onSuccess, Function(String error, int statusCode)? onFailure}) async {
|
|
|
|
|
String url;
|
|
|
|
|
|
|
|
|
|
url = "$BASE_URL/api/PatientCall" + endPoint;
|
|
|
|
|
url = "$BASE_URL/api/PatientCall$endPoint";
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// String token = await sharedPref.getString(TOKEN);
|
|
|
|
|
@ -86,11 +86,11 @@ class BaseAppClient {
|
|
|
|
|
//TODO change this fun
|
|
|
|
|
String error = parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'];
|
|
|
|
|
if (parsed["ValidationErrors"] != null) {
|
|
|
|
|
error = parsed["ValidationErrors"]["StatusMessage"].toString() + "\n";
|
|
|
|
|
error = "${parsed["ValidationErrors"]["StatusMessage"]}\n";
|
|
|
|
|
|
|
|
|
|
if (parsed["ValidationErrors"]["ValidationErrors"] != null && parsed["ValidationErrors"]["ValidationErrors"].length != 0) {
|
|
|
|
|
for (var i = 0; i < parsed["ValidationErrors"]["ValidationErrors"].length; i++) {
|
|
|
|
|
error = error + parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] + "\n";
|
|
|
|
|
error = "${error + parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0]}\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|