refactor: 项目规范
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import axios from 'axios'
|
||||
import router from '@/router/routers'
|
||||
import {Notification} from 'element-ui'
|
||||
import { Notification } from 'element-ui'
|
||||
import store from '../store'
|
||||
import {getToken} from '@/utils/auth'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import Config from '@/settings'
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
@@ -37,7 +37,7 @@ service.interceptors.response.use(
|
||||
if (error.response.data instanceof Blob && error.response.data.type.toLowerCase().indexOf('json') !== -1) {
|
||||
const reader = new FileReader()
|
||||
reader.readAsText(error.response.data, 'utf-8')
|
||||
reader.onload = function (e) {
|
||||
reader.onload = function(e) {
|
||||
const errorMsg = JSON.parse(reader.result).message
|
||||
Notification.error({
|
||||
title: errorMsg,
|
||||
@@ -66,7 +66,7 @@ service.interceptors.response.use(
|
||||
location.reload()
|
||||
})
|
||||
} else if (code === 403) {
|
||||
router.push({path: '/401'})
|
||||
router.push({ path: '/401' })
|
||||
} else {
|
||||
const errorMsg = error.response.data.message
|
||||
if (errorMsg !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user