✨ Basis of publisher page
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user