Browse Source

using AuthService instead of OAuthService

pull/15481/head
Qingxiao Ren 4 years ago
committed by Mahmut Gundogdu
parent
commit
851fc12fd3
  1. 5
      templates/app-nolayers/angular/src/app/home/home.component.ts
  2. 5
      templates/app/angular/src/app/home/home.component.ts

5
templates/app-nolayers/angular/src/app/home/home.component.ts

@ -1,6 +1,5 @@
import { AuthService } from '@abp/ng.core';
import { Component } from '@angular/core';
import { OAuthService } from 'angular-oauth2-oidc';
@Component({
selector: 'app-home',
@ -9,10 +8,10 @@ import { OAuthService } from 'angular-oauth2-oidc';
})
export class HomeComponent {
get hasLoggedIn(): boolean {
return this.oAuthService.hasValidAccessToken();
return this.authService.isAuthenticated;
}
constructor(private oAuthService: OAuthService, private authService: AuthService) {}
constructor(private authService: AuthService) {}
login() {
this.authService.navigateToLogin();

5
templates/app/angular/src/app/home/home.component.ts

@ -1,6 +1,5 @@
import { AuthService } from '@abp/ng.core';
import { Component } from '@angular/core';
import { OAuthService } from 'angular-oauth2-oidc';
@Component({
selector: 'app-home',
@ -9,10 +8,10 @@ import { OAuthService } from 'angular-oauth2-oidc';
})
export class HomeComponent {
get hasLoggedIn(): boolean {
return this.oAuthService.hasValidAccessToken();
return this.authService.isAuthenticated;
}
constructor(private oAuthService: OAuthService, private authService: AuthService) {}
constructor(private authService: AuthService) {}
login() {
this.authService.navigateToLogin();

Loading…
Cancel
Save