mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-21 11:08:54 +00:00
feat: 修改request拦截
This commit is contained in:
@@ -73,6 +73,7 @@ export default {
|
||||
prop: 'hostname',
|
||||
label: this.$t('assets.Hostname'),
|
||||
sortable: true,
|
||||
showOverflowTooltip: true,
|
||||
formatter: DetailFormatter,
|
||||
formatterArgs: {
|
||||
route: 'AssetDetail'
|
||||
|
@@ -49,7 +49,8 @@ service.interceptors.request.use(
|
||||
)
|
||||
|
||||
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 msg = i18n.t('auth.LoginRequiredMsg')
|
||||
@@ -64,7 +65,6 @@ function ifUnauthorized({ response, error }) {
|
||||
}
|
||||
|
||||
function ifBadRequest({ response, error }) {
|
||||
console.log(response)
|
||||
if (response.status === 400) {
|
||||
error.message = i18n.t('common.BadRequestErrorMsg')
|
||||
}
|
||||
|
@@ -31,7 +31,7 @@ module.exports = {
|
||||
productionSourceMap: false,
|
||||
devServer: {
|
||||
port: port,
|
||||
host: 'localhost',
|
||||
host: '0.0.0.0',
|
||||
open: false,
|
||||
overlay: {
|
||||
warnings: false,
|
||||
|
Reference in New Issue
Block a user