mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: delete "deleteSession" method, validate questId and sessionId
This commit is contained in:
1 parent
a7422853fa
commit
5df4967a85
12 files changed
+67
-99
No files matched your search
@@ -45,15 +45,13 @@ async function setSession(session) {
|
||||
|
||||
export async function createSession() {
|
||||
console.log('Creating a new session...')
|
||||
const res = await api.post('/sessions', { quest_id: store.questId })
|
||||
const res = await api.post('/sessions', { questId: store.questId })
|
||||
const { data } = res
|
||||
await setSession(data)
|
||||
}
|
||||
|
||||
async function getActiveSession(questId) {
|
||||
const res = await api.post('/sessions/active', {
|
||||
quest_id: questId,
|
||||
})
|
||||
const res = await api.post('/sessions/active', { questId })
|
||||
const session = res.data
|
||||
try {
|
||||
await setSession(session)
|
||||
|
||||
@@ -12,7 +12,7 @@ class SocketWrapper {
|
||||
|
||||
this.socket = io('', {
|
||||
query: {
|
||||
session_id: session._id,
|
||||
sessionId: session._id,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -23,7 +23,7 @@ class SocketWrapper {
|
||||
this.socket.once('terminal', () => {
|
||||
resolve()
|
||||
})
|
||||
this.socket.once('error', reject)
|
||||
this.socket.once('connect_error', reject)
|
||||
this.bindListeners()
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user