From 23cb60446a7ee2a1aa84fe6519ca00fc57f79acd Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 8 Oct 2019 13:37:11 +0000 Subject: [PATCH] [Library]: Layout Service: Fix some issues. git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@57311 d315682c-612b-4755-9ff5-7f18f6832af3 --- services/layout.service.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/services/layout.service.ts b/services/layout.service.ts index ea0a8d3c..6aa02fa3 100644 --- a/services/layout.service.ts +++ b/services/layout.service.ts @@ -1,8 +1,9 @@ import {Injectable} from '@angular/core'; import {HttpClient, HttpErrorResponse} from '@angular/common/http'; -import {throwError} from 'rxjs'; +import {Observable, throwError} from 'rxjs'; import {CustomOptions} from './servicesUtils/customOptions.class'; import {catchError} from 'rxjs/operators'; +import {CustomizationOptions} from "../connect/community/CustomizationOptions"; @Injectable() export class LayoutService { @@ -20,20 +21,14 @@ export class LayoutService { } } - saveLayout(pid: string, url: string, layout: any) { + saveLayout(communityId: string, url: string, layout: CustomizationOptions): Observable { LayoutService.removeNulls(layout); - return this.http.post(url + 'community/' + pid + '/layout', JSON.stringify(layout), CustomOptions.getAuthOptionsWithBody()) - .pipe(catchError(this.handleError)); + return this.http.post(url + + communityId + '/layout', layout, CustomOptions.getAuthOptionsWithBody()); } - getLayout(pid: string, url: string) { - return this.http.get(url + 'community/' + pid + '/layout') - .pipe(catchError(this.handleError)); - } - - loadDefaultLayout(pid: string, url: string) { - return this.http.post(url + 'community/' + pid + '/resetLayout', null, CustomOptions.getAuthOptionsWithBody()) - .pipe(catchError(this.handleError)); + getLayout(communityId: string, url: string): Observable { + return this.http.get(url + communityId + '/layout'); } mockLayout(): any {