Skip to content

Commit c1a0080

Browse files
committed
Try building the URL another way
1 parent bf24ba6 commit c1a0080

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: src/api/forumAPI.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ import { ForumTopic } from "../types/ForumWebhookTypes";
77
export async function getTopic(id: number): Promise<ForumTopic> {
88
const APIKEY: string | undefined = process.env.FORUM_API_KEY;
99
if (!APIKEY || !APIKEY.length) throw new Error('FORUM_API_KEY is not set in the environment variables.');
10-
const response = await fetch(`https://forums.nexusmods.com/api/forums/topics/${id}?key=${APIKEY}`, {
10+
const params = new URLSearchParams({ key: APIKEY });
11+
const forumsEndpoint = `https://forums.nexusmods.com/api/forums/topics/${id}?${params.toString()}`;
12+
13+
const response = await fetch(forumsEndpoint, {
1114
method: 'GET',
1215
headers: {
1316
'Content-Type': 'application/json',

0 commit comments

Comments
 (0)