File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
packages/comms/src/services Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -4,5 +4,37 @@ export {
44 WsDali
55} ;
66
7+ export interface ExportRequest {
8+ Path : string ;
9+ Safe : boolean ;
10+ }
11+
12+ export interface ExportResponse {
13+ filename : string ;
14+ content : Blob ;
15+ }
16+
717export class DaliService extends DaliServiceBase {
18+
19+ async Export ( request : ExportRequest ) : Promise < ExportResponse > {
20+ const exportUrl = "/WsDali/Export" ;
21+
22+ const reqParams = new URLSearchParams ( ) ;
23+ if ( request . Path ) {
24+ reqParams . append ( "Path" , request . Path ) ;
25+ }
26+ if ( request . Safe !== undefined ) {
27+ reqParams . append ( "Safe" , String ( request . Safe ) ) ;
28+ }
29+
30+ const response = await fetch ( `${ exportUrl } ?${ reqParams . toString ( ) } ` ) ;
31+ const filename = response . headers . get ( "Content-Disposition" ) ;
32+ const content = await response . blob ( ) ;
33+
34+ return {
35+ filename : filename ? filename . split ( "filename=" ) [ 1 ] : "WsDali_Export" ,
36+ content
37+ } ;
38+ }
39+
840}
You can’t perform that action at this time.
0 commit comments