[Library]: Fix layout service with new methods.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@57307 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2019-10-08 10:56:04 +00:00
parent bc427b7e62
commit 52b34e317d
1 changed files with 5 additions and 9 deletions

View File

@ -1,8 +1,8 @@
import {Injectable} from '@angular/core';
import {HttpClient, HttpErrorResponse} from "@angular/common/http";
import {HttpClient, HttpErrorResponse} from '@angular/common/http';
import {throwError} from 'rxjs';
import {CustomOptions} from './servicesUtils/customOptions.class';
import {catchError} from "rxjs/operators";
import {catchError} from 'rxjs/operators';
@Injectable()
export class LayoutService {
@ -22,26 +22,22 @@ export class LayoutService {
saveLayout(pid: string, url: string, layout: any) {
LayoutService.removeNulls(layout);
return this.http.post(url + 'community/' + pid + '/updateLayout', JSON.stringify(layout), CustomOptions.getAuthOptionsWithBody())
//.map(res => res.json())
return this.http.post(url + 'community/' + pid + '/layout', JSON.stringify(layout), CustomOptions.getAuthOptionsWithBody())
.pipe(catchError(this.handleError));
}
getLayout(pid: string, url: string) {
return this.http.get(url + 'community/' + pid + '/layout')
//.map(res => res.json())
.pipe(catchError(this.handleError));
}
loadDefaultLayout(pid: string, url: string) {
return this.http.post(url + 'community/' + pid + '/resetLayout', null, CustomOptions.getAuthOptionsWithBody())
//.map(res => res.json())
.pipe(catchError(this.handleError));
}
mockLayout():any {
return this.http.get("./assets/customizationOptions.json") ;
mockLayout(): any {
return this.http.get('./assets/customizationOptions.json') ;
}