rename layout to customization service, add delete method

This commit is contained in:
argirok 2022-08-08 13:01:53 +03:00
parent 1e3c9d7cba
commit 7069fe6151
1 changed files with 7 additions and 4 deletions

View File

@ -6,7 +6,7 @@ import {CustomizationOptions, Layout} from '../connect/community/CustomizationOp
import {EnvProperties} from "../utils/properties/env-properties"; import {EnvProperties} from "../utils/properties/env-properties";
@Injectable() @Injectable()
export class LayoutService { export class CustomizationService {
constructor(private http: HttpClient) { constructor(private http: HttpClient) {
} }
@ -16,7 +16,7 @@ export class LayoutService {
if (obj[k] === null || obj[k] === '') { if (obj[k] === null || obj[k] === '') {
isArray ? obj.splice(k, 1) : delete obj[k]; isArray ? obj.splice(k, 1) : delete obj[k];
} else if (typeof obj[k] === 'object') { } else if (typeof obj[k] === 'object') {
LayoutService.removeNulls(obj[k]); CustomizationService.removeNulls(obj[k]);
} }
} }
} }
@ -25,11 +25,14 @@ export class LayoutService {
} }
saveLayout(properties: EnvProperties, pid: string, layout: Layout, portalType = null): Observable<Layout> { saveLayout(properties: EnvProperties, pid: string, layout: Layout, portalType = null): Observable<Layout> {
LayoutService.removeNulls(layout); CustomizationService.removeNulls(layout);
return this.http.post<Layout>(properties.adminToolsAPIURL + '/' + (portalType?portalType: properties.adminToolsPortalType) + '/' return this.http.post<Layout>(properties.adminToolsAPIURL + '/' + (portalType?portalType: properties.adminToolsPortalType) + '/'
+ pid + '/layout', layout, CustomOptions.getAuthOptionsWithBody()); + pid + '/layout', layout, CustomOptions.getAuthOptionsWithBody());
} }
deleteLayout(properties: EnvProperties, pid: string, portalType = null): Observable<Layout> {
return this.http.delete<Layout>(properties.adminToolsAPIURL + '/' + (portalType?portalType: properties.adminToolsPortalType) + '/'
+ pid + '/layout', CustomOptions.getAuthOptionsWithBody());
}
getLayout(properties: EnvProperties, pid: string): Observable<Layout> { getLayout(properties: EnvProperties, pid: string): Observable<Layout> {
return this.http.get<Layout>(properties.adminToolsAPIURL+"/" + properties.adminToolsPortalType + '/' return this.http.get<Layout>(properties.adminToolsAPIURL+"/" + properties.adminToolsPortalType + '/'
+ pid + '/layout'); + pid + '/layout');