Fixed various build errors

This commit is contained in:
Christopher
2026-01-22 14:00:12 -08:00
parent cc302c73d4
commit 38a6b88e7e
5 changed files with 13 additions and 15 deletions
+6 -8
View File
@@ -154,14 +154,12 @@ export default function ProfilePage() {
const method = isFollowing ? 'DELETE' : 'POST';
const res = await fetch(`/api/users/${handle}/follow`, { method });
if (res.ok) {
if (res.ok && user) {
setIsFollowing(!isFollowing);
if (user) {
setUser({
...user,
followersCount: isFollowing ? user.followersCount - 1 : user.followersCount + 1,
});
}
setUser({
...user,
followersCount: isFollowing ? (user.followersCount || 0) - 1 : (user.followersCount || 0) + 1,
});
}
};
@@ -352,7 +350,7 @@ export default function ProfilePage() {
fontSize: '14px',
}}>
<CalendarIcon />
<span>Joined {formatDate(user.createdAt)}</span>
<span>Joined {formatDate(user.createdAt || new Date().toISOString())}</span>
</div>
<div style={{ display: 'flex', gap: '16px', marginTop: '12px' }}>
+1 -1
View File
@@ -1,7 +1,7 @@
import { NextResponse } from 'next/server';
import { db, posts, users, notifications } from '@/db';
import { requireAuth } from '@/lib/auth';
import { eq } from 'drizzle-orm';
import { eq, and } from 'drizzle-orm';
type RouteContext = { params: Promise<{ id: string }> };
+2 -2
View File
@@ -70,13 +70,13 @@ export async function GET(
...post,
isLiked: likedPostIds.has(post.id),
isReposted: repostedPostIds.has(post.id),
};
} as any;
replyPosts = replies.map(r => ({
...r,
isLiked: likedPostIds.has(r.id),
isReposted: repostedPostIds.has(r.id),
}));
})) as any;
}
} catch {
// Not authenticated or other error, skip flags
+1 -1
View File
@@ -328,7 +328,7 @@ export async function GET(request: Request) {
...p,
isLiked: likedPostIds.has(p.id),
isReposted: repostedPostIds.has(p.id),
}));
})) as any;
}
}
} catch (error) {
+3 -3
View File
@@ -1,14 +1,14 @@
'use client';
import { useState } from 'react';
import { useState, useEffect } from 'react';
import Link from 'next/link';
import { HeartIcon, RepeatIcon, MessageIcon, FlagIcon } from '@/components/Icons';
import { Post } from '@/lib/types';
interface PostCardProps {
post: Post;
onLike?: (id: string) => void;
onRepost?: (id: string) => void;
onLike?: (id: string, currentLiked: boolean) => void;
onRepost?: (id: string, currentReposted: boolean) => void;
onComment?: (post: Post) => void;
isDetail?: boolean;
}