Set likes to number

This commit is contained in:
Ategon 2025-01-18 12:52:16 -05:00
parent bc7ed52662
commit 32705c8662

View file

@ -9,7 +9,7 @@ import { redirect } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
export default function LikeButton({ post }: { post: PostType }) { export default function LikeButton({ post }: { post: PostType }) {
const [likes, setLikes] = useState(post.likes.length); const [likes, setLikes] = useState<number>(post.likes.length);
return ( return (
<Button <Button
@ -42,7 +42,7 @@ export default function LikeButton({ post }: { post: PostType }) {
return; return;
} }
} else { } else {
setLikes(await response.text()); setLikes(parseInt(await response.text()));
} }
}} }}
> >