script changes
This commit is contained in:
parent
67fee28171
commit
c9f143f113
|
@ -1,8 +1,11 @@
|
|||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
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 { environment } from '../../../../../environments/environment';
|
||||
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';
|
||||
|
||||
@Component({
|
||||
|
@ -14,9 +17,10 @@ export class B2AccessLoginComponent extends BaseComponent implements OnInit {
|
|||
private returnUrl: string;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private loginService: LoginService
|
||||
private authService: AuthService,
|
||||
private loginService: LoginService,
|
||||
private httpClient: HttpClient
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
@ -36,18 +40,18 @@ export class B2AccessLoginComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
public b2AccessLogin(code: String) {
|
||||
// let headers = new HttpHeaders();
|
||||
// headers = headers.set('Content-Type', 'application/json');
|
||||
// headers = headers.set('Accept', 'application/json');
|
||||
// this.httpClient.post(environment.Server + 'auth/b2AccessRequestToken', { code: code }, { headers: headers })
|
||||
// .pipe(takeUntil(this._destroyed))
|
||||
// .subscribe((data: any) => {
|
||||
// this.authService.login({ ticket: data.payload.accessToken, provider: AuthProvider.B2Accesss, data: null })
|
||||
// .pipe(takeUntil(this._destroyed))
|
||||
// .subscribe(
|
||||
// res => this.onLogInSuccess(res),
|
||||
// error => this.onLogInError(error)
|
||||
// );
|
||||
// });
|
||||
let headers = new HttpHeaders();
|
||||
headers = headers.set('Content-Type', 'application/json');
|
||||
headers = headers.set('Accept', 'application/json');
|
||||
this.httpClient.post(environment.Server + 'auth/b2AccessRequestToken', { code: code }, { headers: headers })
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe((data: any) => {
|
||||
this.authService.login({ ticket: data.payload.accessToken, provider: AuthProvider.B2Access, data: null })
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
res => this.loginService.onLogInSuccess(res, this.returnUrl),
|
||||
error => this.loginService.onLogInError(error)
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue