remove doctor profile view model
parent
2e71706cab
commit
6815e47814
@ -1,67 +0,0 @@
|
||||
import 'package:doctor_app_flutter/client/base_app_client.dart';
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
|
||||
import 'package:doctor_app_flutter/core/service/authentication_service.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
|
||||
import 'package:doctor_app_flutter/models/doctor/clinic_model.dart';
|
||||
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
|
||||
|
||||
import '../../locator.dart';
|
||||
|
||||
|
||||
class DoctorProfileViewModel extends BaseViewModel {
|
||||
List<ClinicModel> doctorsClinicList = [];
|
||||
AuthenticationService _authService = locator<AuthenticationService>();
|
||||
|
||||
|
||||
String selectedClinicName;
|
||||
bool isLogin = false;
|
||||
bool isLoading = true;
|
||||
DoctorProfileModel doctorProfile;
|
||||
BaseAppClient baseAppClient = BaseAppClient();
|
||||
setDoctorProfile(DoctorProfileModel profileModel) {
|
||||
doctorProfile = profileModel;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
DoctorProfileViewModel() {
|
||||
getUserProfile();
|
||||
}
|
||||
|
||||
getUserProfile() async {
|
||||
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
|
||||
if (profile != null) {
|
||||
doctorProfile = new DoctorProfileModel.fromJson(profile);
|
||||
isLoading = false;
|
||||
isLogin = true;
|
||||
} else {
|
||||
isLoading = false;
|
||||
isLogin = false;
|
||||
}
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<dynamic> getDocProfiles(docInfo,
|
||||
{bool allowChangeProfile = true}) async {
|
||||
try {
|
||||
dynamic localRes;
|
||||
await baseAppClient.post(GET_DOC_PROFILES,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
localRes = response;
|
||||
if (allowChangeProfile) {
|
||||
doctorProfile =
|
||||
DoctorProfileModel.fromJson(response['DoctorProfileList'][0]);
|
||||
selectedClinicName =
|
||||
response['DoctorProfileList'][0]['ClinicDescription'];
|
||||
}
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
throw error;
|
||||
}, body: docInfo);
|
||||
notifyListeners();
|
||||
return Future.value(localRes);
|
||||
} catch (error) {
|
||||
print(error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue