Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async convertFile() {
- const file = this.f.file.value[0];
- let tempFile = [];
- tempFile.push(file);
- let pathArray = []
- let fullPath : any = '';
- let resp = await this.fileService.generateFolder(pathArray,0,pathArray.length)
- resp.subscribe(
- async (res : any) => {
- await this.generateFile.state.subscribe(
- (fileRes : any) => {
- fullPath = fileRes
- if(fileRes.index == pathArray.length){
- this.fileService.convertFileBase64Try(tempFile , fullPath?.pathTo ).subscribe((res) => {
- if (res) {
- this.formModel = {
- fileContent: res.formModel.fileContent,
- filename: res.formModel.filename,
- fiturId: res.formModel.fiturId,
- folderPath: res.formModel.folderPath,
- fileSize: res.formModel.fileSize
- }
- }
- }, (error) => {
- const dialogConfigError = new MatDialogConfig();
- dialogConfigError.disableClose = true;
- dialogConfigError.data = {
- dialogTitle: 'Gagal Convert File',
- dialogText: error.error.detail,
- isLoading: false
- };
- const dialogErr = this.dialog.open(DialogInfoComponent, dialogConfigError);
- });
- }
- }
- )
- }
- )
- }
Add Comment
Please, Sign In to add comment