mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-12-26 09:26:34 +08:00
refactor: websocket支持单用户多连接
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import router from '../router';
|
||||
import Axios from 'axios';
|
||||
import config from './config';
|
||||
import { getClientUuid, getToken, joinClientParams } from './utils/storage';
|
||||
import { getClientId, getToken } from './utils/storage';
|
||||
import { templateResolve } from './utils/string';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
@@ -54,7 +54,7 @@ service.interceptors.request.use(
|
||||
if (token) {
|
||||
// 设置token
|
||||
config.headers['Authorization'] = token;
|
||||
config.headers['Client-Uuid'] = getClientUuid();
|
||||
config.headers['ClientId'] = getClientId();
|
||||
}
|
||||
return config;
|
||||
},
|
||||
@@ -180,6 +180,11 @@ function getApiUrl(url: string) {
|
||||
return baseUrl + url + '?' + joinClientParams();
|
||||
}
|
||||
|
||||
// 组装客户端参数,包括 token 和 clientId
|
||||
export function joinClientParams(): string {
|
||||
return `token=${getToken()}&clientId=${getClientId()}`;
|
||||
}
|
||||
|
||||
export default {
|
||||
request,
|
||||
get,
|
||||
|
||||
Reference in New Issue
Block a user