From 79d9fc857559982b00b68b2d709807bdc4cd286f Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 11 Apr 2022 10:58:17 +0800
Subject: [PATCH] minio 地址修改
---
src/router/axios.js | 40 +++++++++++++++++++++++++---------------
1 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/src/router/axios.js b/src/router/axios.js
index 15c6d44..16948d0 100644
--- a/src/router/axios.js
+++ b/src/router/axios.js
@@ -8,34 +8,42 @@
import axios from 'axios';
import store from '@/store/';
import router from '@/router/router';
-import { serialize } from '@/util/util';
-import { getToken } from '@/util/auth';
+import {
+ serialize
+} from '@/util/util';
+import {
+ getToken
+} from '@/util/auth';
// import { Message } from 'element-ui';
-import { MessageBox } from 'element-ui';
+import {
+ MessageBox
+} from 'element-ui';
import website from '@/config/website';
-import { Base64 } from 'js-base64';
+import {
+ Base64
+} from 'js-base64';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
//默认超时时间
axios.defaults.timeout = 60000;
//返回其他状态码
-axios.defaults.validateStatus = function(status) {
- return status >= 200 && status <= 500;
+axios.defaults.validateStatus = function (status) {
+ return status >= 200 && status <= 500;
};
//跨域请求,允许保存cookie
axios.defaults.withCredentials = true;
// NProgress 配置
NProgress.configure({
- showSpinner: false
+ showSpinner: false
});
//http request拦截
axios.interceptors.request.use(config => {
- //开启 progress bar
- NProgress.start();
- const meta = (config.meta || {});
- const isToken = meta.isToken === false;
- config.headers['Authorization'] = `Basic ${Base64.encode(`${website.clientId}:${website.clientSecret}`)}`;
+ //开启 progress bar
+ NProgress.start();
+ const meta = (config.meta || {});
+ const isToken = meta.isToken === false;
+ config.headers['Authorization'] = `Basic ${Base64.encode(`${website.clientId}:${website.clientSecret}`)}`;
//让每个请求携带token
if (getToken() && !isToken) {
config.headers[website.tokenHeader] = 'bearer ' + getToken()
@@ -63,9 +71,11 @@
//如果在白名单里则自行catch逻辑处理
if (statusWhiteList.includes(status)) return Promise.reject(res);
//如果是401则跳转到登录页面
- if (status === 401) store.dispatch('FedLogOut').then(() => router.push({path: '/login'}));
+ if (status === 401) store.dispatch('FedLogOut').then(() => router.push({
+ path: '/login'
+ }));
// 如果请求为非200否者默认统一处理
- if (status !== 200) {
+ if (status !== 200 & status !== 201) {
// Message({
// message: message,
// type: 'error'
@@ -80,4 +90,4 @@
return Promise.reject(new Error(error));
});
-export default axios;
\ No newline at end of file
+export default axios;
--
Gitblit v1.9.3