14 lines
378 B
TypeScript
14 lines
378 B
TypeScript
import { usePostStore } from "@/store/posts"
|
|
|
|
export function listPosts() {
|
|
return usePostStore.getState().posts
|
|
}
|
|
|
|
export function getPostById(postId: string) {
|
|
return usePostStore.getState().posts.find((post) => post.id === postId)
|
|
}
|
|
|
|
export function listPostsByAuthor(userId: string) {
|
|
return usePostStore.getState().posts.filter((post) => post.author.id === userId)
|
|
}
|