diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-01-10 19:54:10 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-01-10 19:54:10 -0400 |
commit | fd59ddd05bdfebf2f9a55a0fa5915485929e7de6 (patch) | |
tree | c66b4b8e03fee9cf87ff41ceee1c1763992a0a5e /src/util | |
parent | e06292fe8e7d789d38ac43fd9eee6816e39e18fe (diff) |
don't pass around fullKey where unneeded
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/urls.js | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/util/urls.js b/src/util/urls.js index ead6c769..0733ce04 100644 --- a/src/util/urls.js +++ b/src/util/urls.js @@ -213,24 +213,14 @@ export function getURLsFromRoot({ export function getPagePathname({ baseDirectory, device = false, - fullKey, + pageSubKey, urlArgs, urls, }) { - const [groupKey, subKey] = fullKey.split('.'); - - const toKey = device ? 'toDevice' : 'to'; - - return (groupKey === 'localized' && baseDirectory - ? urls - .from('shared.root')[toKey]( - 'localizedWithBaseDirectory.' + subKey, - baseDirectory, - ...urlArgs) - : urls - .from('shared.root')[toKey]( - fullKey, - ...urlArgs)); + const to = urls.from('shared.root')[device ? 'toDevice' : 'to']; + return (baseDirectory + ? to('localizedWithBaseDirectory.' + pageSubKey, baseDirectory, ...urlArgs) + : to('localized.' + pageSubKey, ...urlArgs)); } export function getPagePathnameAcrossLanguages({ @@ -249,7 +239,7 @@ export function getPagePathnameAcrossLanguages({ (language === defaultLanguage ? '' : language.code), - fullKey: 'localized.' + pageSubKey, + pageSubKey, urlArgs, urls, }), |