Commit 8336f687 authored by TZW's avatar TZW

401

parent 86201be3
......@@ -27,6 +27,7 @@ const codeMessage = {
/* 异常处理程序*/
const errorHandler = (error) => {
console.log(error);
const { response } = error;
if (response && response.status) {
const errorText = codeMessage[response.status] || response.statusText;
......@@ -76,6 +77,9 @@ request.interceptors.request.use(async (url, options) => {
// response拦截器, 处理response
request.interceptors.response.use(async (response, options) => {
if (response?.status == '401') {
window.location.href = '/';
}
if (options.responseType == 'blob') {
const data = await response.clone().blob();
let blobUrl = window.URL.createObjectURL(data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment