4345- Text File Viewer withCredentials (#4349)

* 4345-Text File Viewer not passing withCredentials

* added new line
This commit is contained in:
Venu
2019-02-25 07:37:13 -05:00
committed by Eugenio Romano
parent aca5fd10aa
commit 475a2211fc

View File

@@ -18,6 +18,7 @@
import { HttpClient } from '@angular/common/http';
import { Component, Input, OnChanges, ViewEncapsulation } from '@angular/core';
import { SimpleChanges } from '@angular/core';
import { AppConfigService } from './../../app-config/app-config.service';
@Component({
selector: 'adf-txt-viewer',
@@ -36,7 +37,7 @@ export class TxtViewerComponent implements OnChanges {
content: string | ArrayBuffer;
constructor(private http: HttpClient) {
constructor(private http: HttpClient, private appConfigService: AppConfigService) {
}
ngOnChanges(changes: SimpleChanges): Promise<any> {
@@ -57,8 +58,10 @@ export class TxtViewerComponent implements OnChanges {
}
private getUrlContent(url: string): Promise<any> {
let withCredentialsMode = this.appConfigService.get<boolean>('auth.withCredentials', false);
return new Promise((resolve, reject) => {
this.http.get(url, { responseType: 'text' }).subscribe((res) => {
this.http.get(url, { responseType: 'text', withCredentials: withCredentialsMode }).subscribe((res) => {
this.content = res;
resolve();
}, (event) => {