Summary Table
Categories |
Total Count |
PII |
0 |
URL |
0 |
DNS |
0 |
EKL |
0 |
IP |
0 |
PORT |
0 |
VsID |
0 |
CF |
0 |
AI |
0 |
VPD |
0 |
PL |
0 |
Other |
0 |
File Content
import { Injectable } from '@angular/core';
import {
Http,
Response,
RequestOptions,
ResponseContentType
} from '@angular/http';
// import { HttpClient } from '@angular/common/http';
import { environment } from '../../../environments/environment';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Observable } from 'rxjs/Observable';
import { AttachmentRequest } from './attachment-viewer.model';
import { ExportAsPDFRequest } from './export-as-pdf-request.model';
import 'rxjs/add/operator/map';
@Injectable()
export class AttachmentViewerService {
attachmentViewerState: BehaviorSubject<boolean> = new BehaviorSubject<
boolean
>(false);
private viewerState = false;
constructor(private http: Http,
// private httpClient: HttpClient,
) {}
match(body) {
return this.http
.post(`${environment.nodeserver}/attachment/unmatched837Claim`, body)
.map((response: Response) => response.json());
}
archive(body) {
return this.http
.post(`${environment.nodeserver}/attachment/archiveAttachment`, body)
.map((response: Response) => response.json());
}
reActivate(body) {
return this.http
.post(`${environment.nodeserver}/attachment/archiveAttachment`, body)
.map((response: Response) => response.json());
}
setAttachmentViewerState(state: boolean): void {
this.viewerState = state;
this.attachmentViewerState.next(this.viewerState);
}
viewAttachment(attachmentRequest: AttachmentRequest) {
const options = new RequestOptions({
responseType: ResponseContentType.Blob
});
return this.http.post(
`${environment.nodeserver}/attachment/viewAttachment`,
attachmentRequest,
options
);
// const result = this.httpClient.post(
// `${environment.nodeserver}/attachment/viewAttachment`,
// attachmentRequest,
// { responseType: 'blob' }
// );
// return result; // returns Obersevable<Blob>
}
exportAttachment(attachmentRequest: AttachmentRequest) {
const options = new RequestOptions({
responseType: ResponseContentType.ArrayBuffer
});
return this.http.post(
`${environment.nodeserver}/attachment/exportAttachment`,
attachmentRequest,
options
);
}
exportAsPDF(req: ExportAsPDFRequest) {
const options = new RequestOptions({
responseType: ResponseContentType.ArrayBuffer
});
const result = this.http.post(
`${environment.nodeserver}/attachment/exportAsPDF`,
req,
options
);
return result;
}
cleanXmlTempFolder() {
return this.http
.post(`${environment.nodeserver}/attachment/cleanXml`, {})
.map((response: Response) => response.json());
}
}