feat: 修改request拦截

This commit is contained in:
ibuler
2020-06-10 20:32:58 +08:00
parent 03dc949e26
commit abe8b0f673
3 changed files with 4 additions and 3 deletions

View File

@@ -73,6 +73,7 @@ export default {
prop: 'hostname', prop: 'hostname',
label: this.$t('assets.Hostname'), label: this.$t('assets.Hostname'),
sortable: true, sortable: true,
showOverflowTooltip: true,
formatter: DetailFormatter, formatter: DetailFormatter,
formatterArgs: { formatterArgs: {
route: 'AssetDetail' route: 'AssetDetail'

View File

@@ -49,7 +49,8 @@ service.interceptors.request.use(
) )
function ifUnauthorized({ response, error }) { function ifUnauthorized({ response, error }) {
if (response.status === 401 && response.config.url.indexOf('/users/profile') !== -1) { if (response.status === 401 && response.request.url.indexOf('/users/profile') !== -1) {
response.config.disableFlashErrorMsg = true
// 未授权重定向到登录页面 // 未授权重定向到登录页面
const title = i18n.t('common.Info') const title = i18n.t('common.Info')
const msg = i18n.t('auth.LoginRequiredMsg') const msg = i18n.t('auth.LoginRequiredMsg')
@@ -64,7 +65,6 @@ function ifUnauthorized({ response, error }) {
} }
function ifBadRequest({ response, error }) { function ifBadRequest({ response, error }) {
console.log(response)
if (response.status === 400) { if (response.status === 400) {
error.message = i18n.t('common.BadRequestErrorMsg') error.message = i18n.t('common.BadRequestErrorMsg')
} }

View File

@@ -31,7 +31,7 @@ module.exports = {
productionSourceMap: false, productionSourceMap: false,
devServer: { devServer: {
port: port, port: port,
host: 'localhost', host: '0.0.0.0',
open: false, open: false,
overlay: { overlay: {
warnings: false, warnings: false,