feat: clear navigation stack after successful authentication in login and signup flows
This commit is contained in:
@@ -88,7 +88,11 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
body: BlocConsumer<AuthBloc, AuthState>(
|
body: BlocConsumer<AuthBloc, AuthState>(
|
||||||
listener: (context, state) {
|
listener: (context, state) {
|
||||||
if (state is AuthAuthenticated) {
|
if (state is AuthAuthenticated) {
|
||||||
Navigator.pushReplacementNamed(context, '/home');
|
Navigator.pushNamedAndRemoveUntil(
|
||||||
|
context,
|
||||||
|
'/home',
|
||||||
|
(route) => false,
|
||||||
|
);
|
||||||
} else if (state is AuthError) {
|
} else if (state is AuthError) {
|
||||||
ErrorService().showError(message: state.message);
|
ErrorService().showError(message: state.message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,7 +128,11 @@ class _SignUpPageState extends State<SignUpPage> {
|
|||||||
backgroundColor: Colors.green,
|
backgroundColor: Colors.green,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
Navigator.pushReplacementNamed(context, '/home');
|
Navigator.pushNamedAndRemoveUntil(
|
||||||
|
context,
|
||||||
|
'/home',
|
||||||
|
(route) => false,
|
||||||
|
);
|
||||||
} else if (state is AuthError) {
|
} else if (state is AuthError) {
|
||||||
_errorService.showError(message: state.message);
|
_errorService.showError(message: state.message);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user