From 5a49f83e36fc6623da1107e859dc7fd89aa7228b Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 29 Apr 2020 12:06:55 +0300 Subject: [PATCH] fix login issue by making project id dynamic --- lib/config/shared_pref_kay.dart | 3 ++- lib/widgets/auth/login_form.dart | 1 + lib/widgets/auth/verfiy_account.dart | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 21c15194..9af0820f 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -1 +1,2 @@ -final TOKEN = 'token'; \ No newline at end of file +final TOKEN = 'token'; +final PROJECT_ID="projectID"; \ No newline at end of file diff --git a/lib/widgets/auth/login_form.dart b/lib/widgets/auth/login_form.dart index bc56a07d..a15b019e 100644 --- a/lib/widgets/auth/login_form.dart +++ b/lib/widgets/auth/login_form.dart @@ -198,6 +198,7 @@ class _LoginFormState extends State { changeLoadingStata(true); if (loginFormKey.currentState.validate()) { loginFormKey.currentState.save(); + sharedPref.setInt(PROJECT_ID, userInfo.ProjectID); authProv.login(userInfo).then((res) { changeLoadingStata(false); diff --git a/lib/widgets/auth/verfiy_account.dart b/lib/widgets/auth/verfiy_account.dart index e8c97a54..0cdbd931 100644 --- a/lib/widgets/auth/verfiy_account.dart +++ b/lib/widgets/auth/verfiy_account.dart @@ -256,7 +256,7 @@ class _VerifyAccountState extends State { *@return: *@desc: verify Account func call sendActivationCodeByOtpNotificationType service */ - verifyAccount(AuthProvider authProv, Function changeLoadingStata) { + verifyAccount(AuthProvider authProv, Function changeLoadingStata) async{ if (verifyAccountForm.currentState.validate()) { changeLoadingStata(true); @@ -266,12 +266,12 @@ class _VerifyAccountState extends State { verifyAccountFormValue['digit3'] + verifyAccountFormValue['digit4']; print(activationCode); - print('${_loggedUser}'); + int projectID = await sharedPref.getInt(PROJECT_ID); Map model = { "activationCode": activationCode, "DoctorID": _loggedUser['DoctorID'], "LogInTokenID": _loggedUser['LogInTokenID'], - "ProjectID": 15, + "ProjectID": projectID, "LanguageID": 2, "stamp": "2020-02-26T14:48:27.221Z", "IPAdress": "11.11.11.11",