feat: paginate tweet conversations
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import { createServerFn } from '@tanstack/react-start'
|
||||
import { searchPageInputSchema, userPageInputSchema } from './inputs'
|
||||
import { loadUserPage, searchPage } from './post-service'
|
||||
import type { LoadResult } from './types'
|
||||
import {
|
||||
searchPageInputSchema,
|
||||
threadPageInputSchema,
|
||||
userPageInputSchema,
|
||||
} from './inputs'
|
||||
import { loadThreadPage, loadUserPage, searchPage } from './post-service'
|
||||
import type { LoadFailure } from './types'
|
||||
|
||||
const configFailure = (diagnostic: unknown): LoadResult => {
|
||||
const configFailure = (diagnostic: unknown): LoadFailure => {
|
||||
console.error('Bird client configuration failed:', diagnostic)
|
||||
return {
|
||||
ok: false,
|
||||
@@ -39,3 +43,13 @@ export const searchPosts = createServerFn({ method: 'GET' })
|
||||
return configFailure(error)
|
||||
}
|
||||
})
|
||||
|
||||
export const loadThreadPosts = createServerFn({ method: 'GET' })
|
||||
.validator(threadPageInputSchema)
|
||||
.handler(async ({ data }) => {
|
||||
try {
|
||||
return await loadThreadPage(await reader(), data)
|
||||
} catch (error) {
|
||||
return configFailure(error)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user