mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
refactor: 切换路由都判断下403和404保证他们有权限
This commit is contained in:
parent
4fd4abbcf8
commit
b3b07f6c84
@ -7,11 +7,15 @@ if (!accessApi) {
|
|||||||
throw new Error('[plugin-layout]: plugin-layout depends on plugin-access,please install plugin-access first!');
|
throw new Error('[plugin-layout]: plugin-layout depends on plugin-access,please install plugin-access first!');
|
||||||
}
|
}
|
||||||
|
|
||||||
const accessIds = accessApi.getAccess();
|
|
||||||
accessApi.setAccess(accessIds.concat(['/403', '/404']));
|
|
||||||
|
|
||||||
export const access = (memo) => {
|
export const access = (memo) => {
|
||||||
const runtimeConfig = getConfig();
|
const runtimeConfig = getConfig();
|
||||||
|
const accessIds = accessApi.getAccess();
|
||||||
|
if (!accessIds.includes('/403')) {
|
||||||
|
accessApi.setAccess(accessIds.concat('/403'));
|
||||||
|
}
|
||||||
|
if (!accessIds.includes('/404')) {
|
||||||
|
accessApi.setAccess(accessIds.concat('/404'));
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
unAccessHandler({ router, to, from, next }) {
|
unAccessHandler({ router, to, from, next }) {
|
||||||
if (runtimeConfig.unAccessHandler && typeof runtimeConfig.unAccessHandler === 'function') {
|
if (runtimeConfig.unAccessHandler && typeof runtimeConfig.unAccessHandler === 'function') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user