mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-16 09:39:09 +00:00
refactor(api): Abstract discord API base url to config.ts
Signed-off-by: Katalina Okano <git@kat.cafe>
This commit is contained in:
parent
31ea2e2183
commit
824fee0703
4 changed files with 14 additions and 6 deletions
|
@ -5,7 +5,7 @@ import {
|
|||
import { SessionData, UserGuildPermissions } from '@roleypoly/types';
|
||||
import KSUID from 'ksuid';
|
||||
import { Handler } from '../router';
|
||||
import { allowedCallbackHosts, apiPublicURI, rootUsers } from './config';
|
||||
import { allowedCallbackHosts, apiPublicURI, discordAPIBase, rootUsers } from './config';
|
||||
import { Sessions, WrappedKVNamespace } from './kv';
|
||||
|
||||
export const formData = (obj: Record<string, any>): string => {
|
||||
|
@ -84,7 +84,7 @@ export const discordFetch = async <T>(
|
|||
authType: AuthType = AuthType.Bearer,
|
||||
init?: RequestInit
|
||||
): Promise<T | null> => {
|
||||
const response = await fetch('https://discord.com/api/v8' + url, {
|
||||
const response = await fetch(discordAPIBase + url, {
|
||||
...(init || {}),
|
||||
headers: {
|
||||
...(init?.headers || {}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue