Skip to content

Commit 45d292b

Browse files
authored
Update registerStateListener internal method signature and structure (#9337)
* Update registerStateListener internal method signature and structure
1 parent bd77aed commit 45d292b

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

packages/auth/src/core/auth/auth_impl.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -814,9 +814,9 @@ export class AuthImpl implements AuthInternal, _FirebaseService {
814814
}
815815
}
816816

817-
private registerStateListener(
818-
subscription: Subscription<User>,
819-
nextOrObserver: NextOrObserver<User>,
817+
private registerStateListener<T>(
818+
subscription: Subscription<T>,
819+
nextOrObserver: NextOrObserver<T>,
820820
error?: ErrorFn,
821821
completed?: CompleteFn
822822
): Unsubscribe {
@@ -841,7 +841,14 @@ export class AuthImpl implements AuthInternal, _FirebaseService {
841841
if (isUnsubscribed) {
842842
return;
843843
}
844-
cb(this.currentUser);
844+
if (
845+
(subscription as unknown) === this.idTokenSubscription ||
846+
(subscription as unknown) === this.authStateSubscription
847+
) {
848+
cb(this.currentUser as unknown as T);
849+
} else if ((subscription as unknown) === this.firebaseTokenSubscription) {
850+
cb(this.firebaseToken as unknown as T);
851+
}
845852
});
846853

847854
if (typeof nextOrObserver === 'function') {

0 commit comments

Comments
 (0)