File tree Expand file tree Collapse file tree 4 files changed +29
-6
lines changed
Expand file tree Collapse file tree 4 files changed +29
-6
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,18 @@ if (user && !user.emailVerified) {
118118### Signing Out
119119
120120``` ts
121- firebase ().auth ().signOut ();
121+ firebase ().auth ().signOut ()
122+ .then (res => {
123+ if (res ) {
124+ // user signed out
125+ return
126+ }
127+ // else do staff
128+ });
129+
130+ // OR
131+
132+ let signedOut = await firebase ().auth ().signOut ();
122133```
123134
124135### Other sign-in methods
Original file line number Diff line number Diff line change @@ -1394,8 +1394,20 @@ export class Auth implements IAuth {
13941394 } ) ;
13951395 }
13961396
1397- signOut ( ) {
1398- return this . native ?. signOut ?.( ) ;
1397+ async signOut ( ) : Promise < boolean > {
1398+ return new Promise ( ( resolve , reject ) => {
1399+ this . native ?. signOut ( ) ;
1400+ let timeout = setTimeout ( ( ) => {
1401+ reject ( false ) ;
1402+ } , 3000 ) ;
1403+ this . addAuthStateChangeListener ( ( user ) => {
1404+ clearTimeout ( timeout ) ;
1405+ if ( user ) {
1406+ reject ( false ) ;
1407+ }
1408+ resolve ( true ) ;
1409+ } ) ;
1410+ } )
13991411 }
14001412
14011413 get native ( ) {
Original file line number Diff line number Diff line change @@ -357,7 +357,7 @@ export declare class Auth implements IAuth {
357357
358358 signInWithEmailLink ( email : string , emailLink : string ) : Promise < UserCredential > ;
359359
360- signOut ( ) : boolean ;
360+ signOut ( ) : Promise < boolean > ;
361361
362362 useUserAccessGroup ( userAccessGroup : string ) : Promise < void > ;
363363
Original file line number Diff line number Diff line change @@ -1237,8 +1237,8 @@ export class Auth implements IAuth {
12371237 } ) ;
12381238 }
12391239
1240- signOut ( ) {
1241- return this . native ?. signOut ?.( ) ;
1240+ async signOut ( ) : Promise < boolean > {
1241+ return await this . native ?. signOut ?.( ) ;
12421242 }
12431243
12441244 get native ( ) {
You can’t perform that action at this time.
0 commit comments