|
|
|
|
@ -22,6 +22,8 @@ class BaseAppClient {
|
|
|
|
|
Function(String error, int statusCode) onFailure,
|
|
|
|
|
bool isAllowAny = false}) async {
|
|
|
|
|
String url = BASE_URL + endPoint;
|
|
|
|
|
|
|
|
|
|
bool callLog= true;
|
|
|
|
|
try {
|
|
|
|
|
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
|
|
|
|
|
String token = await sharedPref.getString(TOKEN);
|
|
|
|
|
@ -88,6 +90,12 @@ class BaseAppClient {
|
|
|
|
|
if (statusCode < 200 || statusCode >= 400) {
|
|
|
|
|
onFailure(Helpers.generateContactAdminMsg(), statusCode);
|
|
|
|
|
} else {
|
|
|
|
|
if(callLog){
|
|
|
|
|
callLog = false;
|
|
|
|
|
await AuthenticationViewModel().logout(isSessionTimeout: true);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var parsed = json.decode(response.body.toString());
|
|
|
|
|
if (parsed['ErrorType'] == 4) {
|
|
|
|
|
helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'],
|
|
|
|
|
@ -98,7 +106,7 @@ class BaseAppClient {
|
|
|
|
|
if (body['OTP_SendType'] != null) {
|
|
|
|
|
onFailure(getError(parsed), statusCode);
|
|
|
|
|
} else if (!isAllowAny) {
|
|
|
|
|
await AuthenticationViewModel().logout();
|
|
|
|
|
await AuthenticationViewModel().logout(isSessionTimeout: true);
|
|
|
|
|
Helpers.showErrorToast('Your session expired Please login again');
|
|
|
|
|
}
|
|
|
|
|
if (isAllowAny) {
|
|
|
|
|
|