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) {
118
118
### Signing Out
119
119
120
120
``` 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 ();
122
133
```
123
134
124
135
### Other sign-in methods
Original file line number Diff line number Diff line change @@ -1394,8 +1394,20 @@ export class Auth implements IAuth {
1394
1394
} ) ;
1395
1395
}
1396
1396
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
+ } )
1399
1411
}
1400
1412
1401
1413
get native ( ) {
Original file line number Diff line number Diff line change @@ -357,7 +357,7 @@ export declare class Auth implements IAuth {
357
357
358
358
signInWithEmailLink ( email : string , emailLink : string ) : Promise < UserCredential > ;
359
359
360
- signOut ( ) : boolean ;
360
+ signOut ( ) : Promise < boolean > ;
361
361
362
362
useUserAccessGroup ( userAccessGroup : string ) : Promise < void > ;
363
363
Original file line number Diff line number Diff line change @@ -1237,8 +1237,8 @@ export class Auth implements IAuth {
1237
1237
} ) ;
1238
1238
}
1239
1239
1240
- signOut ( ) {
1241
- return this . native ?. signOut ?.( ) ;
1240
+ async signOut ( ) : Promise < boolean > {
1241
+ return await this . native ?. signOut ?.( ) ;
1242
1242
}
1243
1243
1244
1244
get native ( ) {
You can’t perform that action at this time.
0 commit comments