Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

fix: fix challenge data fetching for not logged in users (#210)

Jim Burbridge540fbd379b70
diff --git a/src/app/challenge/[id]/getChallengeRouteData.ts b/src/app/challenge/[id]/getChallengeRouteData.ts
index 71280b26..37085758 100644
--- a/src/app/challenge/[id]/getChallengeRouteData.ts
+++ b/src/app/challenge/[id]/getChallengeRouteData.ts
@@ -15,17 +15,17 @@ export async function getChallengeRouteData(id: string, session: Session | null)
},
vote: {
where: {
- userId: session?.user.id,
+ userId: session?.user.id || '',
},
},
bookmark: {
where: {
- userId: session?.user.id,
+ userId: session?.user.id || '',
},
},
solution: {
where: {
- userId: session?.user.id,
+ userId: session?.user.id || '',
},
orderBy: [
{