« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/urls.js22
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,
       }),