From b92289812907fb49f32c377dfc128e971eec7562 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期四, 30 九月 2021 16:46:10 +0800 Subject: [PATCH] 修复wvp使用https时播放流地址使用wss,以使用ssl播放 --- web_src/src/main.js | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diff --git a/web_src/src/main.js b/web_src/src/main.js index ed1f36c..ffd7fde 100644 --- a/web_src/src/main.js +++ b/web_src/src/main.js @@ -40,8 +40,20 @@ axios.defaults.baseURL = (process.env.NODE_ENV === 'development') ? process.env.BASE_API : ""; -Vue.prototype.$cookies.config(60*30); +// api 杩斿洖401鑷姩鍥炵櫥闄嗛〉闈� +axios.interceptors.response.use(function (response) { + // 瀵瑰搷搴旀暟鎹仛鐐逛粈涔� + return response; +}, function (error) { + // 瀵瑰搷搴旈敊璇仛鐐逛粈涔� + if (error.response.status === 401) { + console.log("Received 401 Response") + router.push('/login'); + } + return Promise.reject(error); +}); +Vue.prototype.$cookies.config(60*30); new Vue({ router: router, -- Gitblit v1.8.0