Skip to content

Commit

Permalink
Fix disclaimer not appearing in anonymous mode
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-va committed Nov 27, 2024
1 parent e83e86d commit b8d8523
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions libs/client-shared/src/lib/features/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export class AuthService {
private readonly _isInitialized$ = new BehaviorSubject(false);

async initialize(oAuthConfig: Record<string, unknown>) {
if (oAuthConfig['anonymous_mode']) {
const isAnonymous = oAuthConfig['anonymous_mode'];
if (isAnonymous) {
this.setState(AuthState.Success);
this.store.dispatch(appSharedStateActions.setAnonymousMode());
} else {
Expand All @@ -50,6 +51,14 @@ export class AuthService {
this.store.dispatch(appSharedStateActions.loadUserProfile());
}
this._isInitialized$.next(true);

const isLoggedIn = isAnonymous || this._state$.value === AuthState.Success;
if (isLoggedIn && !this.configService.getHideDisclaimer()) {
this.dialogService.open(DisclaimerDialogComponent, {
width: '500px',
disableClose: true,
});
}
}

async signIn(): Promise<void> {
Expand All @@ -62,13 +71,6 @@ export class AuthService {
// If something else has interrupted the auth process, then we don't want to signal a success.
if (this._state$.value === AuthState.Ongoing) {
this._state$.next(AuthState.Success);

if (!this.configService.getHideDisclaimer()) {
this.dialogService.open(DisclaimerDialogComponent, {
width: '500px',
disableClose: true,
});
}
}
}
} else {
Expand Down

0 comments on commit b8d8523

Please sign in to comment.