feat: delete "deleteSession" method, validate questId and sessionId

This commit is contained in:
wancat authored and Lin, Hung-Shin committed 2023-11-14 10:44:52 +08:00
1 parent a7422853fa
commit 5df4967a85
12 files changed
+67 -99

No files matched your search

+2 -4
View File
@@ -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)
+2 -2
View File
@@ -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()
})
}