@@ -35,6 +35,9 @@ export class AuthService {
3535 // Create subject and public observable of user profile data
3636 private userProfileSubject$ = new BehaviorSubject < any > ( null ) ;
3737 userProfile$ = this . userProfileSubject$ . asObservable ( ) ;
38+
39+ isAuthInProgress$ = new BehaviorSubject < boolean > ( false ) ;
40+
3841 // Create a local property for login status
3942 loggedIn : boolean = null ;
4043
@@ -89,6 +92,8 @@ export class AuthService {
8992 // Call when app reloads after user logs in with Auth0
9093 const params = window . location . search ;
9194 if ( params . includes ( 'code=' ) && params . includes ( 'state=' ) ) {
95+ this . isAuthInProgress$ . next ( true ) ;
96+
9297 let targetRoute : string ; // Path to redirect to after login processsed
9398 const authComplete$ = this . handleRedirectCallback$ . pipe (
9499 // Have client, now call method to handle auth callback redirect
@@ -107,6 +112,8 @@ export class AuthService {
107112 // Subscribe to authentication completion observable
108113 // Response will be an array of user and login status
109114 authComplete$ . subscribe ( ( [ user , loggedIn ] ) => {
115+ this . isAuthInProgress$ . next ( false ) ;
116+
110117 // Redirect to target route after callback processing
111118 this . router . navigateByUrl ( targetRoute ) ;
112119 } ) ;
0 commit comments