diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 39193ab..768a44d 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -48,6 +48,7 @@ export class AppComponent implements OnInit , OnDestroy { } } + // tslint:disable-next-line:typedef ngOnInit() { this.loginSub = this.authService.loginSuccess.subscribe( diff --git a/src/app/canvas/canvas.component.ts b/src/app/canvas/canvas.component.ts index f025d37..7b0a8e2 100644 --- a/src/app/canvas/canvas.component.ts +++ b/src/app/canvas/canvas.component.ts @@ -3,6 +3,7 @@ import { Subscription } from 'rxjs'; import { sampleProducts } from '../models/sample_product'; import { MenuService } from '../service/menu.service'; import {AuthService} from '../service/auth.service'; +import {HttpClient} from '@angular/common/http'; @Component({ selector: 'app-canvas', @@ -15,9 +16,7 @@ export class CanvasComponent implements OnInit, OnDestroy { private menutItemSub: Subscription; - - - constructor(private authService: AuthService, private menuService: MenuService) { } + constructor(private menuService: MenuService, private http: HttpClient) { } ngOnInit(): void { this.menutItemSub = this.menuService.itemClicked.subscribe( @@ -32,7 +31,16 @@ export class CanvasComponent implements OnInit, OnDestroy { onButtonClick(){ console.log("ok"); - this.authService.anyhttp(); + this.anyhttp(); + } + + anyhttp(){ + this.http.get('https://svr2021.lawipac.com:8080/api/v1/').subscribe( + response => { + console.log(response); + } + ); } + } diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index f3fc557..8a6e924 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -13,7 +13,7 @@ export class DashboardComponent implements OnInit { public gridData: any[] = sampleProducts; - constructor(private authService: AuthService) { } + constructor() { } ngOnInit(): void { } diff --git a/src/app/service/auth.service.ts b/src/app/service/auth.service.ts index e8be46f..08965fc 100644 --- a/src/app/service/auth.service.ts +++ b/src/app/service/auth.service.ts @@ -19,6 +19,7 @@ export class AuthService { // tslint:disable-next-line:typedef public AutoLogin() { + console.log("autologin"); const sfm: apiV1LoginResponse = JSON.parse(localStorage.getItem('sfm')); if (!sfm) { console.log('no auto login'); @@ -30,6 +31,7 @@ export class AuthService { sfm.session, sfm.sessionExpire ); + console.log("check variable", this.loggedIn); } // tslint:disable-next-line:typedef @@ -83,12 +85,5 @@ export class AuthService { } - anyhttp(){ - this.http.get('https://svr2021.lawipac.com:8080/api/v1/').subscribe( - response => { - console.log(response); - } - ); - } }