From 62409f9feb5f55bc8e3111188d4faac433b406c4 Mon Sep 17 00:00:00 2001 From: sindhu Date: Mon, 26 Aug 2024 07:46:59 +0700 Subject: [PATCH] step 6 : perbaikan login_screen jsonDecode obj and redirect home --- lib/screen/login/login_screen.dart | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/screen/login/login_screen.dart b/lib/screen/login/login_screen.dart index b1881c1..1f574f3 100644 --- a/lib/screen/login/login_screen.dart +++ b/lib/screen/login/login_screen.dart @@ -43,17 +43,24 @@ class LoginScreen extends HookConsumerWidget { final authModel = AuthModel( token: xmodel["token"], model: StaffModel( - companyId: xmodel["model"]["companyId"], - companyName: xmodel["model"]["companyName"], + companyId: xmodel["model"]["company_id"], + companyName: xmodel["model"]["company_name"], email: xmodel["model"]["email"], - staffId: xmodel["model"]["staffId"], - idGoogleSignIn: xmodel['model']['idGoogleSignIn'], + staffId: xmodel["model"]["staff_id"], + idGoogleSignIn: xmodel['model']['id_google_sign_in'], name: xmodel['model']['name'], nip: xmodel['model']['nip'], - phoneNumber: xmodel["model"]["phoneNumber"], + phoneNumber: xmodel["model"]["phone_number"], token: xmodel["model"]["token"], ), ); + + if (xmodel != null) { + ref.read(loginProvider.notifier).login( + authModel.model.email ?? "", + authModel.model.idGoogleSignIn ?? "", + ); + } }); return () {}; }, []);