aboutsummaryrefslogtreecommitdiff
path: root/src/routes
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/constants.json.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/routes/constants.json.ts b/src/routes/constants.json.ts
new file mode 100644
index 0000000..301da58
--- /dev/null
+++ b/src/routes/constants.json.ts
@@ -0,0 +1,18 @@
+import { API_URL } from '$lib/api'
+
+export let constants: any = {}
+
+async function updateConstants() {
+ constants = await fetch(API_URL + 'constants').then(r => r.json())
+ console.log('updated constants')
+}
+
+updateConstants()
+setInterval(updateConstants, 60 * 60 * 1000) // update every hour
+
+export async function get({ request }) {
+ console.log('gotten constants')
+ return {
+ body: constants || {}
+ }
+} \ No newline at end of file