summaryrefslogtreecommitdiff
path: root/resources/js/db.js
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-08-20 14:32:40 +0200
committerDaniel Weipert <code@drogueronin.de>2023-08-20 14:32:40 +0200
commitb227fc9c2ef361f8aa5ee2f24aa1ade6bc972a73 (patch)
tree8fdd7e980107bfd8fcd58ffe21f2299b37d310c8 /resources/js/db.js
parent2c7890e90e1aad371854cfe60ad63eaa88e64fec (diff)
area progress
Diffstat (limited to 'resources/js/db.js')
-rw-r--r--resources/js/db.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/resources/js/db.js b/resources/js/db.js
index e084818..aaf5423 100644
--- a/resources/js/db.js
+++ b/resources/js/db.js
@@ -69,6 +69,8 @@ const DB = {
items: {},
translations: {},
+
+ areas: {},
};
async function initializeDB () {
@@ -152,3 +154,19 @@ async function fetchTranslation (locale) {
return DB.translations[locale];
}
+
+/**
+ * @param {string} slug
+ *
+ * @returns {Promise<Area>}
+ */
+async function fetchArea (slug) {
+ if (! DB.areas[slug]) {
+ DB.areas[slug] = await fetch(`/db/_generated/areas/${slug}.json`).then((response) => response.json());
+ }
+
+ const area = new Area(slug);
+
+
+ return area;
+}