From b0eaf7540556745af4b045343a727c31c843101d Mon Sep 17 00:00:00 2001
From: Baptiste Toulemonde <toulemonde@cines.fr>
Date: Wed, 1 Dec 2021 14:07:52 +0100
Subject: [PATCH] bug fix

---
 src/app/mapping/mapping.component.ts | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/app/mapping/mapping.component.ts b/src/app/mapping/mapping.component.ts
index 8b2910a2e..0b8ded42d 100644
--- a/src/app/mapping/mapping.component.ts
+++ b/src/app/mapping/mapping.component.ts
@@ -23,7 +23,7 @@ import { MappingService } from './service/mapping.service';
   templateUrl: './mapping.component.html',
   styleUrls: ['./mapping.component.scss']
 })
-export class MappingComponent implements OnInit, OnDestroy {
+export class MappingComponent implements OnInit {
 
   addDistribution = false
   check = false;
@@ -473,6 +473,7 @@ export class MappingComponent implements OnInit, OnDestroy {
 
 
     this.mappingService.downloadFile(datasetPathArray);
+    this.mappingService.postFile(datasetPathArray, this.catalogId).subscribe();
   }
 
   openFileInputDialog(): void {
@@ -613,13 +614,7 @@ export class MappingComponent implements OnInit, OnDestroy {
     return this.vocabularies.find((vocabulary: Property) => vocabulary.uri === uri).card;
   }
 
-  ngOnDestroy(): void {
-    let datasetPathArray = this.createObjectToExport();
-    if (datasetPathArray.length > 0) {
-      this.mappingService.postFile(datasetPathArray, this.catalogId).subscribe();
-    }
-    
-  }
+
   private getDistributionEmpty(properties: string, datasetId: string): string {
     return `@prefix dcat: <http://www.w3.org/ns/dcat#>.
     @prefix dct: <http://purl.org/dc/terms/>.
-- 
GitLab