create Menu class for mapping AP response

This commit is contained in:
Alex Martzios 2022-07-15 13:36:55 +03:00
parent e81b3bdc72
commit 5ec26ce0cf
3 changed files with 12 additions and 4 deletions

View File

@ -142,8 +142,8 @@ export class MenuComponent implements OnInit {
this.subscriptions.push(
this._helpContentService.getMenuItems(this.portal).subscribe(
data => {
this.featuredMenuItems = data['featuredMenuItems'];
this.normalMenuItems = data['menuItems'];
this.featuredMenuItems = data.featuredMenuItems;
this.normalMenuItems = data.menuItems;
this.getPages();
this.showLoading = false;
},

View File

@ -14,7 +14,7 @@ import {StatisticsDisplay, StatisticsSummary} from '../connect/statistics/statis
import {CustomOptions} from './servicesUtils/customOptions.class';
import {catchError, map} from "rxjs/operators";
import {properties} from "../../../environments/environment";
import {MenuItem, MenuItemExtended} from '../sharedComponents/menu';
import {Menu, MenuItem, MenuItemExtended} from '../sharedComponents/menu';
@Injectable()
export class HelpContentService {
@ -318,7 +318,7 @@ export class HelpContentService {
// Menu Items
getMenuItems(portalPid: string) {
return this.http.get<Array<MenuItemExtended>>(properties.adminToolsAPIURL + properties.adminToolsPortalType + "/" + portalPid + "/menu/full")
return this.http.get<Menu>(properties.adminToolsAPIURL + properties.adminToolsPortalType + "/" + portalPid + "/menu/full")
.pipe(catchError(this.handleError));
}

View File

@ -72,6 +72,14 @@ export class MenuItemExtended extends MenuItem {
parentItemId: string;
}
export class Menu {
portalPid: string;
isFeaturedMenuEnabled: boolean;
isMenuEnabled: boolean;
featuredMenuItems: MenuItemExtended[] = [];
menuItems: MenuItemExtended[] = [];
}
/**
* @deprecated
* */