From ab2a1950324cb658caf0fb15fe2542dd32aeb8e7 Mon Sep 17 00:00:00 2001 From: Anthony Date: Sat, 9 Jul 2022 15:12:30 +0700 Subject: [PATCH] update account_landing.dart --- .../lib/resources/pages/account_landing.dart | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/LabelStoreMax/lib/resources/pages/account_landing.dart b/LabelStoreMax/lib/resources/pages/account_landing.dart index 1b70b8d..6887598 100644 --- a/LabelStoreMax/lib/resources/pages/account_landing.dart +++ b/LabelStoreMax/lib/resources/pages/account_landing.dart @@ -219,11 +219,17 @@ class _AccountLandingPageState extends NyState { icon: Icons.account_circle); } - if (wpUserLoginResponse != null && wpUserLoginResponse.status == 200) { + if (wpUserLoginResponse == null) { + return; + } + + if (wpUserLoginResponse.status != 200) { + return; + } String? token = wpUserLoginResponse.data!.userToken; String userId = wpUserLoginResponse.data!.userId.toString(); User user = User.fromUserAuthResponse(token: token, userId: userId); - user.save(SharedKey.authUser); + await user.save(SharedKey.authUser); showToastNotification(context, title: trans("Hello"), @@ -232,7 +238,7 @@ class _AccountLandingPageState extends NyState { icon: Icons.account_circle); navigatorPush(context, routeName: UserAuth.instance.redirect, forgetLast: 1); - } + }); } }