mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
4345- Text File Viewer withCredentials (#4349)
* 4345-Text File Viewer not passing withCredentials * added new line
This commit is contained in:
@@ -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) => {
|
||||
|
Reference in New Issue
Block a user