coffeecode12

Untitled

Jun 2nd, 2022
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. async convertFile() {
  2. const file = this.f.file.value[0];
  3. let tempFile = [];
  4. tempFile.push(file);
  5. let pathArray = []
  6. let fullPath : any = '';
  7. let resp = await this.fileService.generateFolder(pathArray,0,pathArray.length)
  8. resp.subscribe(
  9. async (res : any) => {
  10. await this.generateFile.state.subscribe(
  11. (fileRes : any) => {
  12. fullPath = fileRes
  13. if(fileRes.index == pathArray.length){
  14. this.fileService.convertFileBase64Try(tempFile , fullPath?.pathTo ).subscribe((res) => {
  15.  
  16. if (res) {
  17. this.formModel = {
  18. fileContent: res.formModel.fileContent,
  19. filename: res.formModel.filename,
  20. fiturId: res.formModel.fiturId,
  21. folderPath: res.formModel.folderPath,
  22. fileSize: res.formModel.fileSize
  23. }
  24. }
  25. }, (error) => {
  26. const dialogConfigError = new MatDialogConfig();
  27. dialogConfigError.disableClose = true;
  28. dialogConfigError.data = {
  29. dialogTitle: 'Gagal Convert File',
  30. dialogText: error.error.detail,
  31. isLoading: false
  32. };
  33. const dialogErr = this.dialog.open(DialogInfoComponent, dialogConfigError);
  34. });
  35.  
  36. }
  37.  
  38. }
  39. )
  40. }
  41. )
  42. }
Add Comment
Please, Sign In to add comment