| @@ -48,6 +48,7 @@ export class AppComponent implements OnInit , OnDestroy { | |||
| } | |||
| } | |||
| // tslint:disable-next-line:typedef | |||
| ngOnInit() { | |||
| this.loginSub = this.authService.loginSuccess.subscribe( | |||
| @@ -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); | |||
| } | |||
| ); | |||
| } | |||
| } | |||
| @@ -13,7 +13,7 @@ export class DashboardComponent implements OnInit { | |||
| public gridData: any[] = sampleProducts; | |||
| constructor(private authService: AuthService) { } | |||
| constructor() { } | |||
| ngOnInit(): void { | |||
| } | |||
| @@ -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); | |||
| } | |||
| ); | |||
| } | |||
| } | |||