Skip to content

Commit

Permalink
Only resolve login process on success
Browse files Browse the repository at this point in the history
  • Loading branch information
vej-ananas committed Jul 11, 2024
1 parent 7a896de commit bd3f7dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/>
<div class="text">
<p class="welcome">{{ "welcomeTo" | translate }} {{ host }}</p>
<p class="system">Asset Data Management System</p>
<p class="system">Assets</p>
</div>
<ng-container [ngSwitch]="authService.state$ | async">
<ng-container *ngSwitchCase="AuthState.Ongoing">
Expand Down
8 changes: 5 additions & 3 deletions libs/auth/src/lib/services/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ export class AuthService {
async signIn(): Promise<void> {
try {
if (this.state.value === AuthState.Ongoing) {
await this.oauthService.loadDiscoveryDocumentAndLogin();
this.oauthService.setupAutomaticSilentRefresh();
this.state.next(AuthState.Success);
const success = await this.oauthService.loadDiscoveryDocumentAndLogin();
if (success) {
this.oauthService.setupAutomaticSilentRefresh();
this.state.next(AuthState.Success);
}
} else {
this.state.next(AuthState.Ongoing);
this.oauthService.initLoginFlow();
Expand Down

0 comments on commit bd3f7dd

Please sign in to comment.