aboutsummaryrefslogtreecommitdiff
path: root/src/lib/api.ts
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-12-24 19:38:19 -0600
committermat <github@matdoes.dev>2022-12-24 19:38:19 -0600
commitf174a3ed5fb04d038f26339c86f69ebfec175fa9 (patch)
treec13c146bf84d482f803076bae3649cc64c91ee1b /src/lib/api.ts
parentc4ebc9ccd9332928197c72903b72dd0161e55cdb (diff)
downloadskyblock-stats-f174a3ed5fb04d038f26339c86f69ebfec175fa9.tar.gz
skyblock-stats-f174a3ed5fb04d038f26339c86f69ebfec175fa9.tar.bz2
skyblock-stats-f174a3ed5fb04d038f26339c86f69ebfec175fa9.zip
fix server being ratelimited
Diffstat (limited to 'src/lib/api.ts')
-rw-r--r--src/lib/api.ts13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/lib/api.ts b/src/lib/api.ts
index 552607c..01960c4 100644
--- a/src/lib/api.ts
+++ b/src/lib/api.ts
@@ -1,18 +1,9 @@
-import env from './env'
-
// the trailing slash is required
-const API_URL = 'https://skyblock-api.matdoes.dev/'
+export const API_URL = 'https://skyblock-api.matdoes.dev/'
// export const API_URL = 'http://localhost:8080/'
export async function fetchApi(path: string, fetch: (info: RequestInfo, init?: RequestInit | undefined) => Promise<Response>, init?: RequestInit | undefined) {
- const { SKYBLOCK_STATS_API_KEY } = env()
- if (SKYBLOCK_STATS_API_KEY) {
- init = init || {}
- if (!init.headers)
- init.headers = {}
- init.headers['key'] = SKYBLOCK_STATS_API_KEY
- }
-
+ // the header is set in hooks.server.ts
const response = await fetch(API_URL + path, init)
return response
} \ No newline at end of file