diff --git a/lib/features/base/base_controller.dart b/lib/features/base/base_controller.dart index 778d175be..852b63873 100644 --- a/lib/features/base/base_controller.dart +++ b/lib/features/base/base_controller.dart @@ -409,11 +409,16 @@ abstract class BaseController extends GetxController void goToLogin() { if (PlatformInfo.isMobile) { navigateToTwakeWelcomePage(); - } else if (Get.currentRoute != AppRoutes.login) { - pushAndPopAll( - AppRoutes.login, - arguments: LoginArguments(LoginFormType.none) - ); + } else { + navigateToLoginPage(); + } + } + + void removeAllPageAndGoToLogin() { + if (PlatformInfo.isMobile) { + pushAndPopAll(AppRoutes.twakeWelcome); + } else { + navigateToLoginPage(); } } @@ -421,6 +426,15 @@ abstract class BaseController extends GetxController popAndPush(AppRoutes.twakeWelcome); } + void navigateToLoginPage() { + if (Get.currentRoute == AppRoutes.login) { + return; + } + pushAndPopAll( + AppRoutes.login, + arguments: LoginArguments(LoginFormType.none)); + } + void logout(Session? session, AccountId? accountId) async { if (session == null || accountId == null) { await clearDataAndGoToLoginPage(); @@ -464,7 +478,7 @@ abstract class BaseController extends GetxController Future clearDataAndGoToLoginPage() async { log('$runtimeType::clearDataAndGoToLoginPage:'); await clearAllData(); - goToLogin(); + removeAllPageAndGoToLogin(); } Future clearAllData() async {