Skip to content

Commit

Permalink
Moving getGnavSource back to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
bandana147 committed Mar 10, 2025
1 parent 232a45f commit a39e526
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
11 changes: 1 addition & 10 deletions libs/blocks/global-navigation/global-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
loadIms,
decorateLinks,
loadScript,
getGnavSource,
getFedsPlaceholderConfig,
} from '../../utils/utils.js';
import {
Expand Down Expand Up @@ -1349,16 +1350,6 @@ class Gnav {
};
}

async function getGnavSource() {
const { locale, dynamicNavKey } = getConfig();
let url = getMetadata('gnav-source') || `${locale.contentRoot}/gnav`;
if (dynamicNavKey) {
const { default: dynamicNav } = await import('../../features/dynamic-navigation/dynamic-navigation.js');
url = dynamicNav(url, dynamicNavKey);
}
return url;
}

export default async function init(block) {
const { mep } = getConfig();
const sourceUrl = await getGnavSource();
Expand Down
10 changes: 10 additions & 0 deletions libs/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,16 @@ function decorateDefaults(el) {
});
}

export async function getGnavSource() {
const { locale, dynamicNavKey } = getConfig();
let url = getMetadata('gnav-source') || `${locale.contentRoot}/gnav`;
if (dynamicNavKey) {
const { default: dynamicNav } = await import('../features/dynamic-navigation/dynamic-navigation.js');
url = dynamicNav(url, dynamicNavKey);
}
return url;
}

export function isLocalNav() {
const { locale = {} } = getConfig();
const gnavSource = getMetadata('gnav-source') || `${locale.contentRoot}/gnav`;
Expand Down

0 comments on commit a39e526

Please sign in to comment.