diff --git a/app/src/components/TerminalPart.vue b/app/src/components/TerminalPart.vue index 33f1ef9..b25ded3 100644 --- a/app/src/components/TerminalPart.vue +++ b/app/src/components/TerminalPart.vue @@ -14,6 +14,7 @@ import { FitAddon } from 'xterm-addon-fit' import 'xterm/css/xterm.css' import { io } from 'socket.io-client' import { onMounted, ref } from 'vue' +import api from '../utils/api' const rows = ref(40) const cols = ref(100) @@ -37,13 +38,14 @@ onMounted(() => { }, }) const host = 'wss://odyssey.wancat.cc' + const sessionhost = 'http://odyssey.wancat.cc' // const host = 'ws://localhost:3000' const socket = io(host, { query: { // session_id: sessionId, - session_id: '64d26a8cffab987b2bb0de38', + // session_id: '64d26a8cffab987b2bb0de38', // odyssey - // session_id: '64d271ce784daf755387ff4f', + session_id: '64d271ce784daf755387ff4f', // localhost }, }) @@ -56,6 +58,27 @@ onMounted(() => { socket.on('message', (message) => { console.log(message) term.write(message) + const session = + // api.get('') || + // (program.opts().create ? (await createdSession())._id : null) || + // (await lastSession())._id + // if (message == 'Session not found.') { + // term.write('\nSession undefined') + // console.log('Creating a new session...') + // const res = fetch(`${sessionhost}/api/v1/sessions`, { + // method: 'POST', + // headers: { + // 'Content-Type': 'application/json', + // }, + // body: JSON.stringify({ + // questid: 'helloworld', + // }), + // }) + // const data = res.json() + console.log(res) + // console.log(data) + // console.log('Created Session ID:', data.id) + } }) term.onData((key) => { console.log(key)