@soleil-se/app-util
Version:
Utility functions for WebApps, RESTApps and Widgets in Sitevision.
14 lines (12 loc) • 555 B
JavaScript
import { nativeRequire } from '../../server';
export default function getRouteUri(route) {
const PortletContextUtil = nativeRequire('PortletContextUtil');
const currentPage = PortletContextUtil.getCurrentPage();
const currentPortlet = PortletContextUtil.getCurrentPortlet();
if (currentPage && currentPortlet) {
const currentPageId = currentPage.getIdentifier().replace('_sitePage', '');
const currentPortletId = currentPortlet.getIdentifier();
return `/appresource/${currentPageId}/${currentPortletId}/${route}`;
}
return '/';
}