refactor: update current user urls

pull/6168/head
mehmet-erim 5 years ago
parent 6ebdecebfa
commit bb1527f716

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

Loading…
Cancel
Save