Basis of publisher page

This commit is contained in:
2025-11-08 13:29:09 +08:00
parent 1724044bce
commit 209be30d45
9 changed files with 314 additions and 38 deletions

View File

@@ -123,17 +123,24 @@ export const usePostList = (params: PostListParams = {}) => {
const loadMore = async (options?: {
side: string
done: (status: "empty" | "loading" | "error") => void
done: (status: "empty" | "loading" | "error" | "ok") => void
}) => {
if (!state.value.hasMore || state.value.loading) {
if (!state.value.hasMore) {
options?.done("empty")
return
}
if (state.value.loading) {
options?.done("loading")
return
}
const result = await fetchPosts(state.value.cursor, true)
if (result.hasReachedEnd) {
options?.done("empty")
} else {
options?.done("ok")
}
}