fix: normalize SDK response shape in readMessagesFromSDK
Use response.data ?? response to handle both object and array-shaped SDK responses, consistent with all other SDK readers.
This commit is contained in:
parent
9889ac0dd9
commit
c1681ef9ec
@ -62,7 +62,7 @@ export async function readMessagesFromSDK(
|
|||||||
): Promise<StoredMessageMeta[]> {
|
): Promise<StoredMessageMeta[]> {
|
||||||
try {
|
try {
|
||||||
const response = await client.session.messages({ path: { id: sessionID } })
|
const response = await client.session.messages({ path: { id: sessionID } })
|
||||||
const data: unknown = response.data
|
const data: unknown = response.data ?? response
|
||||||
if (!Array.isArray(data)) return []
|
if (!Array.isArray(data)) return []
|
||||||
|
|
||||||
const messages = data
|
const messages = data
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user