update account_landing.dart

This commit is contained in:
Anthony 2022-07-09 15:12:30 +07:00
parent ba5ddc1fa9
commit ab2a195032

View File

@ -219,11 +219,17 @@ class _AccountLandingPageState extends NyState<AccountLandingPage> {
icon: Icons.account_circle); 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? token = wpUserLoginResponse.data!.userToken;
String userId = wpUserLoginResponse.data!.userId.toString(); String userId = wpUserLoginResponse.data!.userId.toString();
User user = User.fromUserAuthResponse(token: token, userId: userId); User user = User.fromUserAuthResponse(token: token, userId: userId);
user.save(SharedKey.authUser); await user.save(SharedKey.authUser);
showToastNotification(context, showToastNotification(context,
title: trans("Hello"), title: trans("Hello"),
@ -232,7 +238,7 @@ class _AccountLandingPageState extends NyState<AccountLandingPage> {
icon: Icons.account_circle); icon: Icons.account_circle);
navigatorPush(context, navigatorPush(context,
routeName: UserAuth.instance.redirect, forgetLast: 1); routeName: UserAuth.instance.redirect, forgetLast: 1);
}
}); });
} }
} }