Implementing Post Retrieval on Personal Website
hi everyone, i have done this in my personal website
and then in my component
I got this error at build time
export const getAndParseHyAllPosts = (query: string) => pipe(
getHyGraph(query),
Effect.flatMap(getJson),
Effect.flatMap(decodeUnknownEither(HyGraphPostsSchema)),
);
...
const posts = await Effect.runPromise(
getAndParseHyAllPosts(`{
posts(orderBy: publishedAt_DESC) {
id,
title,
slug,
publishedAt,
tags,
extract
createdAt
coverImage {
id,
url,
fileName,
}
}
}
`)
)
.then((data) => data.data?.posts || [])
.catch((error) => error);export const getAndParseHyAllPosts = (query: string) => pipe(
getHyGraph(query),
Effect.flatMap(getJson),
Effect.flatMap(decodeUnknownEither(HyGraphPostsSchema)),
);
...
const posts = await Effect.runPromise(
getAndParseHyAllPosts(`{
posts(orderBy: publishedAt_DESC) {
id,
title,
slug,
publishedAt,
tags,
extract
createdAt
coverImage {
id,
url,
fileName,
}
}
}
`)
)
.then((data) => data.data?.posts || [])
.catch((error) => error);and then in my component
{
Match.value(posts).pipe(
Match.when(
ReadonlyArray.isNonEmptyReadonlyArray,
(posts) => posts.map((post) => <Article post={post} />),
),
Match.orElse(() => <Box as="div" width="fullLayout" margin="large" >No posts available</Box>),
)
} {
Match.value(posts).pipe(
Match.when(
ReadonlyArray.isNonEmptyReadonlyArray,
(posts) => posts.map((post) => <Article post={post} />),
),
Match.orElse(() => <Box as="div" width="fullLayout" margin="large" >No posts available</Box>),
)
}I got this error at build time
Argument of type '(post: TPost) => JSX.Element' is no
Types of parameters 'post' and 'value' are incompatible.Argument of type '(post: TPost) => JSX.Element' is no
Types of parameters 'post' and 'value' are incompatible.