feat(post): persist new posts and wire like interactions
This commit is contained in:
+4
-4
@@ -1,13 +1,13 @@
|
||||
import { mockPosts } from "@/lib/mock"
|
||||
import { usePostStore } from "@/store/posts"
|
||||
|
||||
export function listPosts() {
|
||||
return mockPosts
|
||||
return usePostStore.getState().posts
|
||||
}
|
||||
|
||||
export function getPostById(postId: string) {
|
||||
return mockPosts.find((post) => post.id === postId)
|
||||
return usePostStore.getState().posts.find((post) => post.id === postId)
|
||||
}
|
||||
|
||||
export function listPostsByAuthor(userId: string) {
|
||||
return mockPosts.filter((post) => post.author.id === userId)
|
||||
return usePostStore.getState().posts.filter((post) => post.author.id === userId)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user