Compare commits
1 Commits
e7b2721280
...
e7faf92d3c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e7faf92d3c |
@@ -10,12 +10,19 @@ type MessageItem = {
|
||||
isDeleted?: boolean
|
||||
}
|
||||
|
||||
type PageInfo = {
|
||||
nextExpectedSeq?: number
|
||||
highestCommittedSeq?: number
|
||||
hasMore?: boolean
|
||||
}
|
||||
|
||||
export default function ChatPage() {
|
||||
const [searchParams, setSearchParams] = useSearchParams()
|
||||
const guildId = searchParams.get('guildId') ?? ''
|
||||
const [channelId, setChannelId] = useState(() => searchParams.get('channelId') ?? '')
|
||||
const [content, setContent] = useState('')
|
||||
const [messages, setMessages] = useState<MessageItem[]>([])
|
||||
const [pageInfo, setPageInfo] = useState<PageInfo | null>(null)
|
||||
const [socketState, setSocketState] = useState<'offline' | 'online'>('offline')
|
||||
const [seqFrom, setSeqFrom] = useState('1')
|
||||
const [seqTo, setSeqTo] = useState('999999')
|
||||
@@ -55,6 +62,7 @@ export default function ChatPage() {
|
||||
},
|
||||
})
|
||||
setMessages(res.data.items ?? [])
|
||||
setPageInfo(res.data.page ?? null)
|
||||
}
|
||||
|
||||
async function sendMessage() {
|
||||
@@ -133,6 +141,12 @@ export default function ChatPage() {
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
{pageInfo ? (
|
||||
<p>
|
||||
next_expected_seq: {pageInfo.nextExpectedSeq ?? '-'} | highest_committed_seq:{' '}
|
||||
{pageInfo.highestCommittedSeq ?? '-'} | has_more: {String(pageInfo.hasMore ?? false)}
|
||||
</p>
|
||||
) : null}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user