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 {