Skip to content
Snippets Groups Projects

update with fdp 1.12

Merged Baptiste Toulemonde requested to merge fix/search_feature into master
2 files
+ 18
2
Compare changes
  • Side-by-side
  • Inline
Files
2
import { HttpClient } from '@angular/common/http';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { Observable } from 'rxjs';
import { AppConfiguration } from 'src/app/AppConfiguration';
import { AppConfiguration } from 'src/app/AppConfiguration';
@@ -43,15 +43,30 @@ export class PublishRepositoryService {
@@ -43,15 +43,30 @@ export class PublishRepositoryService {
const response = await fetch(myRequest, myInit);
const response = await fetch(myRequest, myInit);
const id = await response.headers.get("location");
const id = await response.headers.get("location");
const url = id
const catId = id.substring(id.search("catalog/") + 8, id.length);
const catId = id.substring(id.search("catalog/") + 8, id.length);
console.log('catalog creaetd with fdp / id = ' + catId);
console.log('catalog creaetd with fdp / id = ' + catId);
 
this.publishMetadata(url);
return this.addUserCatalog(catId);
return this.addUserCatalog(catId);
}
}
return null;
return null;
}
}
 
async publishMetadata(url: string) {
 
if (this.fds2Token) {
 
const httpOptions = {
 
headers: new HttpHeaders({
 
'Content-Type': 'application/json',
 
'Accept': 'application/json',
 
'Authorization': 'Bearer ' + this.fds2Token
 
})
 
};
 
 
return this.http.put(`${url}/meta/state`, { current: 'PUBLISHED' }, httpOptions).toPromise();
 
}
 
}
 
getPersistentUrl(): Observable<PersistentUrlResponse> {
getPersistentUrl(): Observable<PersistentUrlResponse> {
return this.http.get<PersistentUrlResponse>(environment.fdpUrl + '/configs/bootstrap');
return this.http.get<PersistentUrlResponse>(environment.fdpUrl + '/configs/bootstrap');
}
}
Loading