Skip to content

Commit 215135f

Browse files
committed
add whiteList option
1 parent 4555f7b commit 215135f

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/permission.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Message } from 'element-ui'
44
import NProgress from 'nprogress' // progress bar
55
import 'nprogress/nprogress.css'// progress bar style
66
import { getToken } from '@/utils/auth' // getToken from cookie
7+
import settings from '@/settings'
78

89
NProgress.configure({ showSpinner: false })// NProgress Configuration
910

@@ -14,7 +15,7 @@ function hasPermission(roles, permissionRoles) {
1415
return roles.some(role => permissionRoles.indexOf(role) >= 0)
1516
}
1617

17-
const whiteList = ['/login', '/auth-redirect']// no redirect whitelist
18+
const whiteList = settings.whiteList// no redirect whitelist
1819

1920
router.beforeEach((to, from, next) => {
2021
NProgress.start() // start progress bar

src/settings.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,14 @@ export default {
3535
* The default is only used in the production env
3636
* If you want to use it in dev, you can pass ['production','development']
3737
*/
38-
errorLog: 'production'
38+
errorLog: 'production',
39+
40+
/**
41+
* @type {array} ['/login', '/auth-redirect']
42+
* @description Set some pages, you can go in without logging in.
43+
* Detail logic in permission.js
44+
*/
45+
whiteList: ['/login', '/auth-redirect']
3946

4047
// permission: true,
4148
// i18n: true

src/utils/errorLog.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const { errorLog: needErrorLog } = settings
99

1010
function checkNeed(arg) {
1111
const env = process.env.NODE_ENV
12-
console.log(needErrorLog)
1312
if (isString(needErrorLog)) {
1413
return env === needErrorLog
1514
}

0 commit comments

Comments
 (0)