summaryrefslogtreecommitdiff
path: root/resources/js/db.js
diff options
context:
space:
mode:
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;
+}