Skip to content

Commit

Permalink
fixed router error
Browse files Browse the repository at this point in the history
  • Loading branch information
chuma-beep committed Nov 30, 2024
1 parent d82d7b7 commit df93ce8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/profile/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle }
import { CalendarIcon, Heart, MessageCircle } from 'lucide-react';
import ReactMarkdown from 'react-markdown';
import BackButton from '@/components/BackButton';
import { useRouter } from 'next/router'

interface Profile {
username: string;
Expand Down Expand Up @@ -130,11 +131,13 @@ function PostList({ posts }: { posts: Post[] }) {
}

export default function UserProfile() {
const { id } = useParams();
const { query } = useRouter()
const id = Array.isArray(query.id) ? query.id[0] : query.id;
const [loading, setLoading] = useState(true);
const [profile, setProfile] = useState<Profile | null>(null);
const [posts, setPosts] = useState<Post[]>([]);


useEffect(() => {
if (id) {
(async () => {
Expand Down

0 comments on commit df93ce8

Please sign in to comment.