Skip to content

Commit cb86934

Browse files
committed
fix(auth): handle authentication failure
- Improved error handling in UI. - Updated state management for clarity. - Replaced direct state checks with enum.
1 parent d172c21 commit cb86934

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/authentication/view/email_code_verification_page.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@ class EmailCodeVerificationPage extends StatelessWidget {
2929
body: SafeArea(
3030
child: BlocConsumer<AuthenticationBloc, AuthenticationState>(
3131
listener: (context, state) {
32-
if (state is AuthenticationFailure) {
32+
if (state.status == AuthenticationStatus.failure) {
3333
ScaffoldMessenger.of(context)
3434
..hideCurrentSnackBar()
3535
..showSnackBar(
3636
SnackBar(
37-
content: Text(state.errorMessage),
37+
content: Text(state.errorMessage!),
3838
backgroundColor: colorScheme.error,
3939
),
4040
);
4141
}
4242
// Successful authentication is handled by AppBloc redirecting.
4343
},
4444
builder: (context, state) {
45-
final isLoading = state is AuthenticationLoading;
45+
final isLoading = state.status == AuthenticationStatus.loading;
4646

4747
return Padding(
4848
padding: const EdgeInsets.all(AppSpacing.paddingLarge),

0 commit comments

Comments
 (0)