|
|
@ -1,5 +1,10 @@ |
|
|
import { ApplicationConfiguration, AuthService, ConfigStateService } from '@abp/ng.core'; |
|
|
import { |
|
|
import { Component, OnInit } from '@angular/core'; |
|
|
ApplicationConfiguration, |
|
|
|
|
|
AuthService, |
|
|
|
|
|
ConfigStateService, |
|
|
|
|
|
EnvironmentService, |
|
|
|
|
|
} from '@abp/ng.core'; |
|
|
|
|
|
import { Component } from '@angular/core'; |
|
|
import { Router } from '@angular/router'; |
|
|
import { Router } from '@angular/router'; |
|
|
import { Observable } from 'rxjs'; |
|
|
import { Observable } from 'rxjs'; |
|
|
|
|
|
|
|
|
@ -8,7 +13,7 @@ import { Observable } from 'rxjs'; |
|
|
// tslint:disable-next-line: component-max-inline-declarations
|
|
|
// tslint:disable-next-line: component-max-inline-declarations
|
|
|
template: ` |
|
|
template: ` |
|
|
<ng-template #loginBtn> |
|
|
<ng-template #loginBtn> |
|
|
<a role="button" class="nav-link" routerLink="/account/login">{{ |
|
|
<a role="button" class="nav-link pointer" (click)="initLogin()">{{ |
|
|
'AbpAccount::Login' | abpLocalization |
|
|
'AbpAccount::Login' | abpLocalization |
|
|
}}</a> |
|
|
}}</a> |
|
|
</ng-template> |
|
|
</ng-template> |
|
|
@ -36,7 +41,7 @@ import { Observable } from 'rxjs'; |
|
|
aria-labelledby="dropdownMenuLink" |
|
|
aria-labelledby="dropdownMenuLink" |
|
|
[class.d-block]="smallScreen && currentUserDropdown.isOpen()" |
|
|
[class.d-block]="smallScreen && currentUserDropdown.isOpen()" |
|
|
> |
|
|
> |
|
|
<a class="dropdown-item" routerLink="/account/manage-profile" |
|
|
<a class="dropdown-item" [href]="manageProfileUrl" |
|
|
><i class="fa fa-cog mr-1"></i>{{ 'AbpAccount::ManageYourProfile' | abpLocalization }}</a |
|
|
><i class="fa fa-cog mr-1"></i>{{ 'AbpAccount::ManageYourProfile' | abpLocalization }}</a |
|
|
> |
|
|
> |
|
|
<a class="dropdown-item" href="javascript:void(0)" (click)="logout()" |
|
|
<a class="dropdown-item" href="javascript:void(0)" (click)="logout()" |
|
|
@ -46,7 +51,7 @@ import { Observable } from 'rxjs'; |
|
|
</div> |
|
|
</div> |
|
|
`,
|
|
|
`,
|
|
|
}) |
|
|
}) |
|
|
export class CurrentUserComponent implements OnInit { |
|
|
export class CurrentUserComponent { |
|
|
currentUser$: Observable<ApplicationConfiguration.CurrentUser> = this.configState.getOne$( |
|
|
currentUser$: Observable<ApplicationConfiguration.CurrentUser> = this.configState.getOne$( |
|
|
'currentUser', |
|
|
'currentUser', |
|
|
); |
|
|
); |
|
|
@ -55,13 +60,22 @@ export class CurrentUserComponent implements OnInit { |
|
|
return window.innerWidth < 992; |
|
|
return window.innerWidth < 992; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
get manageProfileUrl() { |
|
|
|
|
|
return `${this.environment.getEnvironment().oAuthConfig.issuer}/Account/Manage?returnUrl=${ |
|
|
|
|
|
window.location.href |
|
|
|
|
|
}`;
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
constructor( |
|
|
constructor( |
|
|
private authService: AuthService, |
|
|
private authService: AuthService, |
|
|
private router: Router, |
|
|
private router: Router, |
|
|
private configState: ConfigStateService, |
|
|
private configState: ConfigStateService, |
|
|
|
|
|
private environment: EnvironmentService, |
|
|
) {} |
|
|
) {} |
|
|
|
|
|
|
|
|
ngOnInit() {} |
|
|
initLogin() { |
|
|
|
|
|
this.authService.initLogin(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
logout() { |
|
|
logout() { |
|
|
this.authService.logout().subscribe(() => { |
|
|
this.authService.logout().subscribe(() => { |
|
|
|