add whiteList option
This commit is contained in:
parent
4555f7b91b
commit
215135ffb6
|
@ -4,6 +4,7 @@ import { Message } from 'element-ui'
|
||||||
import NProgress from 'nprogress' // progress bar
|
import NProgress from 'nprogress' // progress bar
|
||||||
import 'nprogress/nprogress.css'// progress bar style
|
import 'nprogress/nprogress.css'// progress bar style
|
||||||
import { getToken } from '@/utils/auth' // getToken from cookie
|
import { getToken } from '@/utils/auth' // getToken from cookie
|
||||||
|
import settings from '@/settings'
|
||||||
|
|
||||||
NProgress.configure({ showSpinner: false })// NProgress Configuration
|
NProgress.configure({ showSpinner: false })// NProgress Configuration
|
||||||
|
|
||||||
|
@ -14,7 +15,7 @@ function hasPermission(roles, permissionRoles) {
|
||||||
return roles.some(role => permissionRoles.indexOf(role) >= 0)
|
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) => {
|
router.beforeEach((to, from, next) => {
|
||||||
NProgress.start() // start progress bar
|
NProgress.start() // start progress bar
|
||||||
|
|
|
@ -35,7 +35,14 @@ export default {
|
||||||
* The default is only used in the production env
|
* The default is only used in the production env
|
||||||
* If you want to use it in dev, you can pass ['production','development']
|
* 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,
|
// permission: true,
|
||||||
// i18n: true
|
// i18n: true
|
||||||
|
|
|
@ -9,7 +9,6 @@ const { errorLog: needErrorLog } = settings
|
||||||
|
|
||||||
function checkNeed(arg) {
|
function checkNeed(arg) {
|
||||||
const env = process.env.NODE_ENV
|
const env = process.env.NODE_ENV
|
||||||
console.log(needErrorLog)
|
|
||||||
if (isString(needErrorLog)) {
|
if (isString(needErrorLog)) {
|
||||||
return env === needErrorLog
|
return env === needErrorLog
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue