Login page lifecycle fix
This commit is contained in:
@@ -59,7 +59,10 @@ export class LoginPageComponent implements OnInit {
|
||||
email: responsePayload.email,
|
||||
avatar: responsePayload.picture
|
||||
});
|
||||
this.loading = true;
|
||||
this.ngZone$.run(() => {
|
||||
this.loading = true;
|
||||
});
|
||||
await this.sleep(2500);
|
||||
await this.auth$.getAPIToken(response.credential);
|
||||
this.ngZone$.run(() => {
|
||||
this.router$.navigate(['/app']);
|
||||
@@ -67,21 +70,32 @@ export class LoginPageComponent implements OnInit {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (e: any) {
|
||||
console.error('handleCredentialResponse', e);
|
||||
this.loading = false;
|
||||
this.ngZone$.run(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
if (e.status === 401) {
|
||||
this.notifications$.add({
|
||||
text: "Użytkownik nie istnieje w bazie danych aplikacji DiunaBI.",
|
||||
duration: 2500
|
||||
this.ngZone$.run(() => {
|
||||
this.notifications$.add({
|
||||
text: "Użytkownik nie istnieje w bazie danych aplikacji DiunaBI.",
|
||||
btn: "OK",
|
||||
duration: 15000
|
||||
});
|
||||
});
|
||||
} else {
|
||||
this.notifications$.add({
|
||||
text: "Błąd połączenia z serwerem. Skontaktuj się z administratorem.",
|
||||
duration: 2500
|
||||
this.ngZone$.run(() => {
|
||||
this.notifications$.add({
|
||||
text: "Błąd połączenia z serwerem. Skontaktuj się z administratorem.",
|
||||
btn: "OK",
|
||||
duration: 15000
|
||||
});
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
}
|
||||
sleep(ms: number) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,10 @@ mat-card {
|
||||
cursor: pointer;
|
||||
}
|
||||
.text {
|
||||
display: inline-block;
|
||||
width: 70%;
|
||||
float: left;
|
||||
}
|
||||
.btn {
|
||||
display: inline-block;
|
||||
width: 30%;
|
||||
text-align: right;
|
||||
float: right;
|
||||
color: red;
|
||||
margin-left: 5px;
|
||||
}
|
||||
Reference in New Issue
Block a user