feat(post): persist new posts and wire like interactions

This commit is contained in:
zetaloop
2026-02-22 08:29:59 +08:00
parent 237cf90f5e
commit 43a0cf7a73
6 changed files with 136 additions and 28 deletions
+4 -4
View File
@@ -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)
}