fix 修复请求头客户端和后端不一致问题

This commit is contained in:
AprilWind 2024-01-19 17:18:31 +08:00
parent fdf885c261
commit e92d7a0202
2 changed files with 3 additions and 3 deletions

View File

@ -18,12 +18,12 @@ export const isRelogin = { show: false };
export const globalHeaders = () => { export const globalHeaders = () => {
return { return {
Authorization: 'Bearer ' + getToken(), Authorization: 'Bearer ' + getToken(),
clientid: import.meta.env.VITE_APP_CLIENT_ID clientId: import.meta.env.VITE_APP_CLIENT_ID
}; };
}; };
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'; axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8';
axios.defaults.headers['clientid'] = import.meta.env.VITE_APP_CLIENT_ID; axios.defaults.headers['clientId'] = import.meta.env.VITE_APP_CLIENT_ID;
// 创建 axios 实例 // 创建 axios 实例
const service = axios.create({ const service = axios.create({
baseURL: import.meta.env.VITE_APP_BASE_API, baseURL: import.meta.env.VITE_APP_BASE_API,

View File

@ -36,7 +36,7 @@ export const initWebSocket = (url: any) => {
} }
socketUrl = url; socketUrl = url;
// 初始化 websocket // 初始化 websocket
websocket = new WebSocket(url + '?Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID); websocket = new WebSocket(url + '?Authorization=Bearer ' + getToken() + '&clientId=' + import.meta.env.VITE_APP_CLIENT_ID);
websocketonopen(); websocketonopen();
websocketonmessage(); websocketonmessage();
websocketonerror(); websocketonerror();