add Makefile, fixed websocket url for https

This commit is contained in:
RockYang
2023-03-23 18:10:23 +08:00
parent a061881d4a
commit 2067aa3f83
9 changed files with 72 additions and 9 deletions

View File

@@ -2,7 +2,7 @@ import axios from 'axios'
import {getSessionId} from "@/utils/storage";
axios.defaults.timeout = 5000
axios.defaults.baseURL = process.env.VUE_APP_API_SECURE === true ? 'https://' + process.env.VUE_APP_API_HOST : 'http://' + process.env.VUE_APP_API_HOST
axios.defaults.baseURL = process.env.VUE_APP_API_HOST
axios.defaults.withCredentials = true;
axios.defaults.headers.post['Content-Type'] = 'application/json'

View File

@@ -198,6 +198,8 @@ export default defineComponent({
confirmButtonText: '重连会话',
cancelButtonText: '不聊了',
type: 'warning',
showClose: false,
closeOnClickModal: false
}
).then(() => {
this.connect();
@@ -214,7 +216,7 @@ export default defineComponent({
connect: function () {
// 初始化 WebSocket 对象
const token = getSessionId();
const socket = new WebSocket('ws://' + process.env.VUE_APP_API_HOST + '/api/chat?token=' + token);
const socket = new WebSocket(process.env.VUE_APP_WS_HOST + '/api/chat?token=' + token);
socket.addEventListener('open', () => {
ElMessage.success('创建会话成功!');