未验证 提交 5a9d3c07 编写于 作者: 陈小聪 提交者: GitHub

fix: error-processing-request (#3402)

* Close: #3398

* error authority is undefined
上级 bdc92d5c
......@@ -8,11 +8,12 @@ export const dva = {
},
};
let authRoutes = null;
let authRoutes = {};
function ergodicRoutes(routes, authKey, authority) {
routes.forEach(element => {
if (element.path === authKey) {
if (!element.authority) element.authority = []; // eslint-disable-line
Object.assign(element.authority, authority || []);
} else if (element.routes) {
ergodicRoutes(element.routes, authKey, authority);
......@@ -31,8 +32,13 @@ export function patchRoutes(routes) {
export function render(oldRender) {
fetch('/api/auth_routes')
.then(res => res.json())
.then(ret => {
authRoutes = ret;
oldRender();
});
.then(
ret => {
authRoutes = ret;
oldRender();
},
() => {
oldRender();
}
);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册