Skip to content
Snippets Groups Projects

delete fdp & smartharvester settings: config from environement and get user...

Merged Baptiste Toulemonde requested to merge feature/mapping into master
1 file
+ 10
21
Compare changes
  • Side-by-side
  • Inline
@@ -2,7 +2,7 @@ import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { AppConfiguration } from 'src/app/AppConfiguration';
import { AuthService } from 'src/app/authentication/services/auth.service';
import { TokenStorageService } from 'src/app/authentication/services/token-storage.service';
import { ParseXmlService } from '../../services/parse-xml.service';
@@ -11,15 +11,12 @@ import { ParseXmlService } from '../../services/parse-xml.service';
})
export class DatasetCrudService {
fds2Token: string
fds2Token: string = this.sessionStorage.getFDPToken();
public results: string[] = [];
itemsDataset: Object[] = [] ;
constructor(private http: HttpClient,private appConfig: AppConfiguration, private authService: AuthService, private parserService: ParseXmlService) { }
constructor(private http: HttpClient,private appConfig: AppConfiguration, private parserService: ParseXmlService, private sessionStorage: TokenStorageService) { }
createDataSet(data:string){
this.authService.getF2DSAuthToken().subscribe(token=>{
this.fds2Token = token.token
if (this.fds2Token) {
const httpOptions = {
headers: new HttpHeaders({
@@ -29,28 +26,21 @@ export class DatasetCrudService {
})
};
this.http.post(this.appConfig.fdpurl+"/dataset", data, httpOptions ).subscribe(
(r)=>{
if (r){
this.http.post(this.appConfig.fdpurl+"/dataset", data, httpOptions ).subscribe( r => {
console.log("resultat: " + JSON.stringify(r));
}
},
error => console.error("The repository has not been published")
error => console.error("The repository has not been published: " + error) ,
() => console.log("The datasets has benn published")
) ;
}
})
}
createDistribution(data:string){
this.authService.getF2DSAuthToken().subscribe(data=>{
this.fds2Token = data.token
})
if (this.fds2Token) {
const httpOptions = {
headers: new HttpHeaders({
@@ -60,11 +50,10 @@ export class DatasetCrudService {
})
};
let resultat = this.http.post(this.appConfig.fdpurl+"/distribution", data, httpOptions ).subscribe( (r)=>{console.log('reponse: ', r)}) ;
if (resultat){
console.log("resultat: " + JSON.stringify(resultat));
let resultat = this.http.post(this.appConfig.fdpurl+"/distribution", data, httpOptions ).subscribe((r)=>{
console.log('reponse: ', r);
return JSON.stringify(resultat);
}
}) ;
}
}
Loading