mirror of
https://github.com/Ategon/Jamjar.git
synced 2025-02-12 06:16:21 +00:00
Fix prod link for getCurrentJam
This commit is contained in:
parent
5462af1a5a
commit
94a3d31e8d
1 changed files with 14 additions and 17 deletions
|
@ -18,28 +18,25 @@ export async function getJams(): Promise<JamType[]> {
|
|||
}
|
||||
|
||||
export async function getCurrentJam(): Promise<ActiveJamResponse | null> {
|
||||
|
||||
try {
|
||||
const response = await fetch(
|
||||
process.env.NEXT_PUBLIC_MODE === "PROD"
|
||||
? "https://d2jam.com/api/v1/jams"
|
||||
? "https://d2jam.com/api/v1/jams/active"
|
||||
: "http://localhost:3005/api/v1/jams/active"
|
||||
);
|
||||
|
||||
// Parse JSON response
|
||||
const data = await response.json();
|
||||
|
||||
// Return the phase and jam details
|
||||
return {
|
||||
phase: data.phase,
|
||||
jam: data.jam,
|
||||
};
|
||||
|
||||
} catch (error) {
|
||||
console.error("Error fetching active jam:", error);
|
||||
return null;
|
||||
}
|
||||
const data = await response.json();
|
||||
|
||||
// Return the phase and jam details
|
||||
return {
|
||||
phase: data.phase,
|
||||
jam: data.jam,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Error fetching active jam:", error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export async function joinJam(jamId: number) {
|
||||
|
@ -53,7 +50,7 @@ export async function joinJam(jamId: number) {
|
|||
userSlug: getCookie("user"),
|
||||
}),
|
||||
method: "POST",
|
||||
credentials: 'include',
|
||||
credentials: "include",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
authorization: `Bearer ${getCookie("token")}`,
|
||||
|
@ -80,7 +77,7 @@ export async function hasJoinedCurrentJam(): Promise<boolean> {
|
|||
? "https://d2jam.com/api/v1/participation"
|
||||
: "http://localhost:3005/api/v1/participation",
|
||||
{
|
||||
credentials: 'include',
|
||||
credentials: "include",
|
||||
headers: {
|
||||
Authorization: `Bearer ${getCookie("token")}`,
|
||||
},
|
||||
|
@ -92,4 +89,4 @@ export async function hasJoinedCurrentJam(): Promise<boolean> {
|
|||
console.error("Error checking jam participation:", error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue