script changes

This commit is contained in:
Diamantis Tziotzios 2019-09-02 13:18:09 +03:00
parent 67fee28171
commit c9f143f113
12 changed files with 20 additions and 16 deletions

View File

@ -1,8 +1,11 @@
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Params, Router } from '@angular/router'; import { ActivatedRoute, Params } from '@angular/router';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
import { environment } from '../../../../../environments/environment'; import { environment } from '../../../../../environments/environment';
import { BaseComponent } from '../../../../core/common/base/base.component'; import { BaseComponent } from '../../../../core/common/base/base.component';
import { AuthProvider } from '../../../../core/common/enum/auth-provider';
import { AuthService } from '../../../../core/services/auth/auth.service';
import { LoginService } from '../utilities/login.service'; import { LoginService } from '../utilities/login.service';
@Component({ @Component({
@ -14,9 +17,10 @@ export class B2AccessLoginComponent extends BaseComponent implements OnInit {
private returnUrl: string; private returnUrl: string;
constructor( constructor(
private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
private loginService: LoginService private authService: AuthService,
private loginService: LoginService,
private httpClient: HttpClient
) { ) {
super(); super();
} }
@ -36,18 +40,18 @@ export class B2AccessLoginComponent extends BaseComponent implements OnInit {
} }
public b2AccessLogin(code: String) { public b2AccessLogin(code: String) {
// let headers = new HttpHeaders(); let headers = new HttpHeaders();
// headers = headers.set('Content-Type', 'application/json'); headers = headers.set('Content-Type', 'application/json');
// headers = headers.set('Accept', 'application/json'); headers = headers.set('Accept', 'application/json');
// this.httpClient.post(environment.Server + 'auth/b2AccessRequestToken', { code: code }, { headers: headers }) this.httpClient.post(environment.Server + 'auth/b2AccessRequestToken', { code: code }, { headers: headers })
// .pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
// .subscribe((data: any) => { .subscribe((data: any) => {
// this.authService.login({ ticket: data.payload.accessToken, provider: AuthProvider.B2Accesss, data: null }) this.authService.login({ ticket: data.payload.accessToken, provider: AuthProvider.B2Access, data: null })
// .pipe(takeUntil(this._destroyed)) .pipe(takeUntil(this._destroyed))
// .subscribe( .subscribe(
// res => this.onLogInSuccess(res), res => this.loginService.onLogInSuccess(res, this.returnUrl),
// error => this.onLogInError(error) error => this.loginService.onLogInError(error)
// ); );
// }); });
} }
} }