diff options
| author | mat <github@matdoes.dev> | 2022-02-16 22:13:11 +0000 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-02-16 22:13:11 +0000 |
| commit | cd982e64595ab47a5fa71a40f8249893dbf867df (patch) | |
| tree | a2c9c5ed31bd1f5f48c3b992f344cc2f461ecebc /src/routes | |
| parent | 81543e5307c98df0d44c1cf553bcdfefbfe4ea7f (diff) | |
| download | skyblock-stats-cd982e64595ab47a5fa71a40f8249893dbf867df.tar.gz skyblock-stats-cd982e64595ab47a5fa71a40f8249893dbf867df.tar.bz2 skyblock-stats-cd982e64595ab47a5fa71a40f8249893dbf867df.zip | |
add
Diffstat (limited to 'src/routes')
| -rw-r--r-- | src/routes/constants.json.ts | 18 |
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 |
