add whiteList option

This commit is contained in:
Pan 2018-10-10 17:02:12 +08:00
parent 4555f7b91b
commit 215135ffb6
3 changed files with 10 additions and 3 deletions

View File

@ -4,6 +4,7 @@ import { Message } from 'element-ui'
import NProgress from 'nprogress' // progress bar
import 'nprogress/nprogress.css'// progress bar style
import { getToken } from '@/utils/auth' // getToken from cookie
import settings from '@/settings'
NProgress.configure({ showSpinner: false })// NProgress Configuration
@ -14,7 +15,7 @@ function hasPermission(roles, permissionRoles) {
return roles.some(role => permissionRoles.indexOf(role) >= 0)
}
const whiteList = ['/login', '/auth-redirect']// no redirect whitelist
const whiteList = settings.whiteList// no redirect whitelist
router.beforeEach((to, from, next) => {
NProgress.start() // start progress bar

View File

@ -35,7 +35,14 @@ export default {
* The default is only used in the production env
* If you want to use it in dev, you can pass ['production','development']
*/
errorLog: 'production'
errorLog: 'production',
/**
* @type {array} ['/login', '/auth-redirect']
* @description Set some pages, you can go in without logging in.
* Detail logic in permission.js
*/
whiteList: ['/login', '/auth-redirect']
// permission: true,
// i18n: true

View File

@ -9,7 +9,6 @@ const { errorLog: needErrorLog } = settings
function checkNeed(arg) {
const env = process.env.NODE_ENV
console.log(needErrorLog)
if (isString(needErrorLog)) {
return env === needErrorLog
}