session management update

merge-requests/994/merge
Elham Rababh 4 years ago
parent c30d6bebd8
commit 8069e89a61

@ -40,17 +40,13 @@ class BaseAppClient {
try { try {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
String token = await sharedPref.getString(TOKEN); String token = await sharedPref.getString(TOKEN);
// String doctorID = await sharedPref.getString(DOCTOR_ID);
// if(doctorID != null)
// body['DoctorID'] = int.parse(doctorID);
if (profile != null) { if (profile != null) {
DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile);
if (body['DoctorID'] == null) { if (body['DoctorID'] == null) {
body['DoctorID'] = doctorProfile?.doctorID; body['DoctorID'] = doctorProfile?.doctorID;
} }
if (body['DoctorID'] == "") if (body['DoctorID'] == "") body['DoctorID'] = null;
body['DoctorID'] = null;
if (body['EditedBy'] == null) if (body['EditedBy'] == null)
body['EditedBy'] = doctorProfile?.doctorID; body['EditedBy'] = doctorProfile?.doctorID;
if (body['ProjectID'] == null) { if (body['ProjectID'] == null) {
@ -59,10 +55,13 @@ class BaseAppClient {
if (body['ClinicID'] == null) if (body['ClinicID'] == null)
body['ClinicID'] = doctorProfile?.clinicID; body['ClinicID'] = doctorProfile?.clinicID;
} } else {
String doctorID = await sharedPref.getString(DOCTOR_ID);
if (body['DoctorID'] == '') { if (body['DoctorID'] == '') {
body['DoctorID'] = null; body['DoctorID'] = null;
} else if (doctorID != null) body['DoctorID'] = int.parse(doctorID);
} }
if (body['EditedBy'] == '') { if (body['EditedBy'] == '') {
body.remove("EditedBy"); body.remove("EditedBy");
} }

@ -59,8 +59,7 @@ class DashboardViewModel extends BaseViewModel {
_firebaseMessaging.getToken().then((String token) async { _firebaseMessaging.getToken().then((String token) async {
if (token != '') { if (token != '') {
// DEVICE_TOKEN = token; // DEVICE_TOKEN = token;
///TODO Elham* return back authProvider.insertDeviceImei(token);
// authProvider.insertDeviceImei(token);
} }
}); });
} }

Loading…
Cancel
Save