fix tags bug

This commit is contained in:
Jordi Enric
2024-11-01 15:16:10 +01:00
parent 0a6178e4f1
commit 136a8f0080
@@ -24,11 +24,18 @@ export default function Post() {
const tagsQuery = usePostTags({ blogId, postId: post?.data?.id || "" });
const tags = tagsQuery.data?.map((tagRes) => ({
name: tagRes.blog_tags?.name || "",
id: tagRes.blog_tags?.id || "",
slug: tagRes.blog_tags?.slug || "",
}));
const tags = tagsQuery.data
?.map((tagRes) => {
if (!tagRes.blog_tags) {
return;
}
return {
name: tagRes.blog_tags?.name,
id: tagRes.blog_tags?.id,
slug: tagRes.blog_tags?.slug,
};
})
.filter((tag) => tag !== undefined);
if (isLoading || tagsQuery.isLoading || isRefetching) {
return (