Patrick Sun 4 лет назад
Родитель
Сommit
7ee2fc6db5
4 измененных файлов: 16 добавлений и 12 удалений
  1. +1
    -0
      src/app/app.component.ts
  2. +12
    -4
      src/app/canvas/canvas.component.ts
  3. +1
    -1
      src/app/dashboard/dashboard.component.ts
  4. +2
    -7
      src/app/service/auth.service.ts

+ 1
- 0
src/app/app.component.ts Просмотреть файл

} }
} }



// tslint:disable-next-line:typedef // tslint:disable-next-line:typedef
ngOnInit() { ngOnInit() {
this.loginSub = this.authService.loginSuccess.subscribe( this.loginSub = this.authService.loginSuccess.subscribe(

+ 12
- 4
src/app/canvas/canvas.component.ts Просмотреть файл

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);
}
);
} }



} }

+ 1
- 1
src/app/dashboard/dashboard.component.ts Просмотреть файл



public gridData: any[] = sampleProducts; public gridData: any[] = sampleProducts;


constructor(private authService: AuthService) { }
constructor() { }


ngOnInit(): void { ngOnInit(): void {
} }

+ 2
- 7
src/app/service/auth.service.ts Просмотреть файл



// 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);
}
);
}


} }

Загрузка…
Отмена
Сохранить