mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-08 18:54:22 -04:00
Making the login works without the need of a reload
This commit is contained in:
parent
04944c5164
commit
81b30950e3
@ -26,7 +26,7 @@
|
||||
</li>
|
||||
<ng-template #accountDrop>
|
||||
<li #accountParent class="nav-item icon" style="opacity: 1 !important;">
|
||||
<img matRipple [src]="authManager.user.picture" [matMenuTriggerFor]="accountMenu" class="profilePicture" matTooltipPosition="below" [matTooltip]="authManager.user.name" fallback="more.svg" (error)="accountParent.style.removeProperty('opacity');" />
|
||||
<img matRipple [src]="authManager.user.picture" [matMenuTriggerFor]="accountMenu" class="profilePicture" matTooltipPosition="below" [matTooltip]="authManager.user.username" fallback="more.svg" (error)="accountParent.style.removeProperty('opacity');" />
|
||||
</li>
|
||||
<mat-menu #accountMenu="matMenu">
|
||||
<button class="dropButton" mat-menu-item (click)="this.openAccountDialog()">Settings</button>
|
||||
|
@ -17,7 +17,6 @@ export class AppComponent
|
||||
{
|
||||
libraries: Library[];
|
||||
isLoading: boolean = false;
|
||||
account: Account;
|
||||
|
||||
constructor(private http: HttpClient, private router: Router, private location: Location, private authManager: AuthService, public dialog: MatDialog)
|
||||
{
|
||||
@ -47,8 +46,6 @@ export class AppComponent
|
||||
|
||||
if (!navigator.userAgent.match(/Mobi/))
|
||||
document.body.classList.add("hoverEnabled");
|
||||
|
||||
this.account = this.authManager.getAccount();
|
||||
}
|
||||
|
||||
openSearch()
|
||||
@ -81,11 +78,10 @@ export class AppComponent
|
||||
|
||||
openAccountDialog()
|
||||
{
|
||||
const dialog = this.dialog.open(AccountComponent, {width: "500px", data: this.account});
|
||||
const dialog = this.dialog.open(AccountComponent, {width: "500px", data: this.authManager.getAccount()});
|
||||
dialog.afterClosed().subscribe((result: Account) =>
|
||||
{
|
||||
if (result)
|
||||
this.account = result;
|
||||
this.authManager.getUser();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -26,14 +26,17 @@ export class AuthService
|
||||
this.isAuthenticated = auth;
|
||||
});
|
||||
|
||||
this.oidcSecurityService.getUserData().subscribe(userData =>
|
||||
{
|
||||
this.user = userData;
|
||||
console.log("Got user data:");
|
||||
console.log(this.user);
|
||||
});
|
||||
this.getUser();
|
||||
}
|
||||
|
||||
getUser()
|
||||
{
|
||||
this.oidcSecurityService.getUserData().subscribe(userData =>
|
||||
{
|
||||
this.user = userData;
|
||||
});
|
||||
}
|
||||
|
||||
login()
|
||||
{
|
||||
this.oidcSecurityService.authorize();
|
||||
@ -56,8 +59,6 @@ export class AuthService
|
||||
{
|
||||
if (!this.isAuthenticated)
|
||||
return null;
|
||||
console.log("Running get account");
|
||||
console.log(this.user);
|
||||
return {email: this.user.email, username: this.user.username, picture: this.user.picture};
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user