mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
fix: archive session
This commit is contained in:
@@ -132,6 +132,21 @@ export function createSessionsRoutes(getSyncEngine: () => SyncEngine | null): Ho
|
||||
return c.json({ ok: true })
|
||||
})
|
||||
|
||||
app.post('/sessions/:id/archive', async (c) => {
|
||||
const engine = requireSyncEngine(c, getSyncEngine)
|
||||
if (engine instanceof Response) {
|
||||
return engine
|
||||
}
|
||||
|
||||
const sessionResult = requireSessionFromParam(c, engine, { requireActive: true })
|
||||
if (sessionResult instanceof Response) {
|
||||
return sessionResult
|
||||
}
|
||||
|
||||
await engine.archiveSession(sessionResult.sessionId)
|
||||
return c.json({ ok: true })
|
||||
})
|
||||
|
||||
app.post('/sessions/:id/switch', async (c) => {
|
||||
const engine = requireSyncEngine(c, getSyncEngine)
|
||||
if (engine instanceof Response) {
|
||||
|
||||
Reference in New Issue
Block a user