Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit f0950bf

Browse files
Merge remote-tracking branch 'origin/master'
2 parents d886e71 + 5a28ab0 commit f0950bf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/app/auth/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { FirebaseEmailLinkActionCodeSettings, LoginType, User } from "../../fire
44
export namespace auth {
55
export class Auth {
66
private authStateChangedHandler;
7+
private authStateOnErrorHandler;
78
public currentUser: User;
89
public languageCode: string | null;
910

@@ -33,6 +34,7 @@ export namespace auth {
3334
// } else if (message.includes('com.google.firebase.auth.FirebaseAuthInvalidUserException')) {
3435
// code = 'auth/invalid-email'
3536
}
37+
this.authStateOnErrorHandler && this.authStateOnErrorHandler(err.toString());
3638
reject({
3739
code: code,
3840
message: message
@@ -41,8 +43,10 @@ export namespace auth {
4143
});
4244
}
4345

44-
public onAuthStateChanged(handler: (user: User) => void): void {
46+
// Completed will never be called, but it is here to closely follow the web api interface.
47+
public onAuthStateChanged(handler: (user: User) => void, error?: (err) => any, completed?: () => any): void {
4548
this.authStateChangedHandler = handler;
49+
if (error) this.authStateOnErrorHandler = error;
4650
console.log(">> added onAuthStateChanged handler");
4751
}
4852

@@ -55,6 +59,7 @@ export namespace auth {
5559
resolve();
5660
})
5761
.catch(err => {
62+
this.authStateOnErrorHandler && this.authStateOnErrorHandler(err);
5863
reject({
5964
// code: "",
6065
message: err

0 commit comments

Comments
 (0)