|
@@ -2,8 +2,7 @@ import type { Settings as LayoutSettings } from '@ant-design/pro-layout'
|
|
import { notification } from 'antd'
|
|
import { notification } from 'antd'
|
|
import { PageLoading } from '@ant-design/pro-layout'
|
|
import { PageLoading } from '@ant-design/pro-layout'
|
|
import type { RequestConfig, RunTimeLayoutConfig } from 'umi'
|
|
import type { RequestConfig, RunTimeLayoutConfig } from 'umi'
|
|
-import { Link } from 'umi'
|
|
|
|
-import { history } from 'umi'
|
|
|
|
|
|
+import { Link, history } from 'umi'
|
|
import type { RequestOptionsInit, ResponseError } from 'umi-request'
|
|
import type { RequestOptionsInit, ResponseError } from 'umi-request'
|
|
import RightContent from '@/components/RightContent'
|
|
import RightContent from '@/components/RightContent'
|
|
// import { currentUser as queryCurrentUser } from './services/ant-design-pro/api'
|
|
// import { currentUser as queryCurrentUser } from './services/ant-design-pro/api'
|
|
@@ -89,6 +88,9 @@ export const request: RequestConfig = {
|
|
errorHandler: (error: ResponseError) => {
|
|
errorHandler: (error: ResponseError) => {
|
|
// const { messages } = getIntl(getLocale())
|
|
// const { messages } = getIntl(getLocale())
|
|
const { response } = error
|
|
const { response } = error
|
|
|
|
+ if (response.code === consts.TOKEN_EXPIRED) {
|
|
|
|
+ return history.push(loginPath)
|
|
|
|
+ }
|
|
if (response && response.msg) {
|
|
if (response && response.msg) {
|
|
// const { status, statusText, url } = response
|
|
// const { status, statusText, url } = response
|
|
// const requestErrorMessage = messages['app.request.error']
|
|
// const requestErrorMessage = messages['app.request.error']
|