ref: 优化websocket 链接

This commit is contained in:
lbw 2023-03-08 13:17:42 +08:00
parent f0b0347769
commit ade034e96d
2 changed files with 4 additions and 5 deletions

View File

@ -51,9 +51,9 @@
import { useMessage } from '/@/hooks/message';
import other from '/@/utils/other';
import { Session } from '/@/utils/storage';
import {useI18n} from 'vue-i18n';
import { useI18n } from 'vue-i18n';
const {t} = useI18n()
const { t } = useI18n();
const emit = defineEmits(['sizeChange', 'refreshDataList']);
const prop = defineProps({
@ -123,10 +123,9 @@ const show = () => {
};
const headers = computed(() => {
const tenantId = Session.getTenant();
return {
Authorization: 'Bearer ' + Session.getToken(),
'TENANT-ID': tenantId,
'TENANT-ID': Session.getTenant(),
};
});

View File

@ -47,7 +47,7 @@ onUnmounted(() => {
const initWebSocket = () => {
// ws
let host = window.location.host;
let wsUri = `ws://${host}${props.uri}?access_token=${token.value}&TENANT-ID=${tenant}`;
let wsUri = `ws://${host}${props.uri}?access_token=${token.value}&TENANT-ID=${tenant.value}`;
//
state.webSocket = new WebSocket(wsUri);
//