« get me outta code hell

urls: factor out generic reused root/path subkeys - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-05-01 19:57:00 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-01 20:00:46 -0300
commite9eb08953d9ff25c23d67168d7b9d47599425f42 (patch)
treec88f64c8ab3e43ae0662514094697c8e783721c7 /src
parenta2bd7af8919e282b1ae8ff3c339dea50b1051249 (diff)
urls: factor out generic reused root/path subkeys
Diffstat (limited to 'src')
-rw-r--r--src/url-spec.js23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/url-spec.js b/src/url-spec.js
index ea5337a..8537dfe 100644
--- a/src/url-spec.js
+++ b/src/url-spec.js
@@ -1,12 +1,16 @@
 import {withEntries} from '#sugar';
 
+const genericPaths = {
+  root: '',
+  path: '<>/',
+};
+
 const urlSpec = {
   data: {
     prefix: 'data/',
 
     paths: {
-      root: '',
-      path: '<>',
+      ...genericPaths,
 
       album: 'album/<>',
       artist: 'artist/<>',
@@ -19,8 +23,7 @@ const urlSpec = {
     // prefix: '_languageCode',
 
     paths: {
-      root: '',
-      path: '<>',
+      ...genericPaths,
       page: '<>/',
 
       home: '',
@@ -61,8 +64,7 @@ const urlSpec = {
 
   shared: {
     paths: {
-      root: '',
-      path: '<>',
+      ...genericPaths,
 
       utilityRoot: 'util',
       staticRoot: 'static',
@@ -78,8 +80,7 @@ const urlSpec = {
     prefix: 'media/',
 
     paths: {
-      root: '',
-      path: '<>',
+      ...genericPaths,
 
       albumAdditionalFile: 'album-additional/<>/<>',
       albumBanner: 'album-art/<>/banner.<>',
@@ -96,11 +97,7 @@ const urlSpec = {
 
   thumb: {
     prefix: 'thumb/',
-
-    paths: {
-      root: '',
-      path: '<>',
-    },
+    paths: genericPaths,
   },
 };