Преглед изворни кода

autologin worked

tags/2.037
Patrick Sun пре 4 година
родитељ
комит
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 Прегледај датотеку

@@ -48,6 +48,7 @@ export class AppComponent implements OnInit , OnDestroy {
}
}


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

+ 12
- 4
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);
}
);
}


}

+ 1
- 1
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 {
}

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

}

Loading…
Откажи
Сачувај