upgrade umi@3 partly

This commit is contained in:
Baorong Li
2020-03-18 16:17:25 +08:00
parent c6ea0454b3
commit 422a6fed30
23 changed files with 65 additions and 99 deletions
+6 -5
View File
@@ -1,10 +1,11 @@
/* global window */
import { router } from 'utils'
import { history } from 'umi'
import { stringify } from 'qs'
import store from 'store'
const { pathToRegexp } = require("path-to-regexp")
import { ROLE_TYPE } from 'utils/constant'
import { queryLayout, pathMatchRegexp } from 'utils'
import { queryLayout } from 'utils'
import { CANCEL_REQUEST_MESSAGE } from 'utils/constant'
import api from 'api'
import config from 'config'
@@ -12,8 +13,8 @@ import config from 'config'
const { queryRouteList, logoutUser, queryUserInfo } = api
const goDashboard = () => {
if (pathMatchRegexp(['/', '/login'], window.location.pathname)) {
router.push({
if (pathToRegexp(['/', '/login'], window.location.pathname)) {
history.push({
pathname: '/dashboard',
})
}
@@ -112,7 +113,7 @@ export default {
store.set('isInit', true)
goDashboard()
} else if (queryLayout(config.layouts, locationPathname) !== 'public') {
router.push({
history.push({
pathname: '/login',
search: stringify({
from: locationPathname,