feat: send response to frontend

This commit is contained in:
wancat committed 2024-02-29 10:54:53 +08:00
1 parent fb69cb4e10
commit 88ee8f2cc3
8 files changed
+46 -35

No files matched your search

@@ -51,16 +51,16 @@ export const newCommand = asyncHandler(async (req: Request, res: Response) => {
c.stage = response.stage
await c.save()
session.responses.push(response.responses)
if (response.stage === 'END') {
await finishSession(session)
}
commandCompleteCallbacks.set(session.id, response.callback)
pushToSession(session.id, 'status', 'pending')
res.status(201).json(response)
} else {
res.status(200).end()
// commandCompleteCallbacks.set(session.id, response.callback)
pushToSession(session.id, 'response', response)
}
res.status(200).end()
await session.save()
})