Skip to content

Commit

Permalink
Fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
henry232323 committed Dec 4, 2024
1 parent 0f6973e commit ddd5ec4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/api/routes/v1/orders/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ export async function createOffer(
const bot_response = await createOfferThread(session)
invite_code = bot_response.result.invite_code
await database.updateOfferSession(session.id, {
thread_id: bot_response.result.thread.thread_id,
thread_id: bot_response.result.thread?.thread_id || null,
})
session.thread_id = bot_response.result.thread.thread_id
session.thread_id = bot_response.result.thread?.thread_id || null
} catch (e) {
logger.error(`Failed to create thread ${e}`)
}
Expand Down
4 changes: 2 additions & 2 deletions src/api/routes/v1/orders/orders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1567,13 +1567,13 @@ ordersRouter.post(

try {
const bot_response = await createThread(req.order!)
if (bot_response.result.thread.thread_id) {
if (bot_response.result.thread?.thread_id) {
await database.updateOrder(req.order!.order_id, {
thread_id: bot_response.result.thread.thread_id,
})
} else {
logger.error("Failed to create thread", bot_response)
return res.status(500).json({ message: "An unknown error occurred" })
return res.status(500).json({ message: bot_response.result.message })
}
} catch (e) {
logger.error("Failed to create thread", e)
Expand Down

0 comments on commit ddd5ec4

Please sign in to comment.