Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix: Comment auth error

Richie McIlroy03fdae0c9947
diff --git a/apps/web/app/api/video/comment/route.ts b/apps/web/app/api/video/comment/route.ts
index f944badc9..95cf5df84 100644
--- a/apps/web/app/api/video/comment/route.ts
+++ b/apps/web/app/api/video/comment/route.ts
@@ -10,7 +10,8 @@ async function handlePost(request: NextRequest) {
const user = await getCurrentUser();
const { type, content, videoId, timestamp, parentCommentId } =
await request.json();
- const userId = user?.id as string;
+
+ const userId = user?.id || "anonymous";
if (!type || !content || !videoId) {
console.error("Missing required data in /api/video/comment/route.ts");
@@ -27,7 +28,7 @@ async function handlePost(request: NextRequest) {
await db.insert(comments).values({
id: id,
- authorId: userId ?? "anonymous",
+ authorId: userId,
type: type,
content: content,
videoId: videoId,