| } | } | ||||
| } | } | ||||
| // tslint:disable-next-line:typedef | // tslint:disable-next-line:typedef | ||||
| ngOnInit() { | ngOnInit() { | ||||
| this.loginSub = this.authService.loginSuccess.subscribe( | this.loginSub = this.authService.loginSuccess.subscribe( |
| import { sampleProducts } from '../models/sample_product'; | import { sampleProducts } from '../models/sample_product'; | ||||
| import { MenuService } from '../service/menu.service'; | import { MenuService } from '../service/menu.service'; | ||||
| import {AuthService} from '../service/auth.service'; | import {AuthService} from '../service/auth.service'; | ||||
| import {HttpClient} from '@angular/common/http'; | |||||
| @Component({ | @Component({ | ||||
| selector: 'app-canvas', | selector: 'app-canvas', | ||||
| private menutItemSub: Subscription; | private menutItemSub: Subscription; | ||||
| constructor(private authService: AuthService, private menuService: MenuService) { } | |||||
| constructor(private menuService: MenuService, private http: HttpClient) { } | |||||
| ngOnInit(): void { | ngOnInit(): void { | ||||
| this.menutItemSub = this.menuService.itemClicked.subscribe( | this.menutItemSub = this.menuService.itemClicked.subscribe( | ||||
| onButtonClick(){ | onButtonClick(){ | ||||
| console.log("ok"); | console.log("ok"); | ||||
| this.authService.anyhttp(); | |||||
| this.anyhttp(); | |||||
| } | |||||
| anyhttp(){ | |||||
| this.http.get('https://svr2021.lawipac.com:8080/api/v1/').subscribe( | |||||
| response => { | |||||
| console.log(response); | |||||
| } | |||||
| ); | |||||
| } | } | ||||
| } | } |
| public gridData: any[] = sampleProducts; | public gridData: any[] = sampleProducts; | ||||
| constructor(private authService: AuthService) { } | |||||
| constructor() { } | |||||
| ngOnInit(): void { | ngOnInit(): void { | ||||
| } | } |
| // tslint:disable-next-line:typedef | // tslint:disable-next-line:typedef | ||||
| public AutoLogin() { | public AutoLogin() { | ||||
| console.log("autologin"); | |||||
| const sfm: apiV1LoginResponse = JSON.parse(localStorage.getItem('sfm')); | const sfm: apiV1LoginResponse = JSON.parse(localStorage.getItem('sfm')); | ||||
| if (!sfm) { | if (!sfm) { | ||||
| console.log('no auto login'); | console.log('no auto login'); | ||||
| sfm.session, | sfm.session, | ||||
| sfm.sessionExpire | sfm.sessionExpire | ||||
| ); | ); | ||||
| console.log("check variable", this.loggedIn); | |||||
| } | } | ||||
| // tslint:disable-next-line:typedef | // tslint:disable-next-line:typedef | ||||
| } | } | ||||
| anyhttp(){ | |||||
| this.http.get('https://svr2021.lawipac.com:8080/api/v1/').subscribe( | |||||
| response => { | |||||
| console.log(response); | |||||
| } | |||||
| ); | |||||
| } | |||||
| } | } |