This commit is contained in:
Phuoc Nguyen
2025-10-10 17:51:31 +07:00
parent 10ccd0300d
commit 77440ac957
7 changed files with 300 additions and 11 deletions

View File

@@ -127,6 +127,7 @@ class Auth extends _$Auth {
return result.fold(
(failure) {
print('❌ Login FAILED: ${failure.message}');
state = state.copyWith(
isAuthenticated: false,
isLoading: false,
@@ -135,12 +136,14 @@ class Auth extends _$Auth {
return false;
},
(authResponse) {
print('✅ Login SUCCESS: user=${authResponse.user.name}, token length=${authResponse.accessToken.length}');
state = AuthState(
user: authResponse.user,
isAuthenticated: true,
isLoading: false,
errorMessage: null,
);
print('✅ State updated: isAuthenticated=${state.isAuthenticated}');
return true;
},
);