fix 修复请求头客户端和后端不一致问题
This commit is contained in:
parent
fdf885c261
commit
e92d7a0202
@ -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,
|
||||||
|
@ -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();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user