Browse Source

Merge pull request #15359 from rqx110/patch-1

Angular: using AuthService instead of OAuthService
pull/15483/head
Mahmut Gundogdu 4 years ago
committed by GitHub
parent
commit
8a96749296
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  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