Unverified Commit 5a9d3c07 authored by 陈小聪's avatar 陈小聪 Committed by GitHub

fix: error-processing-request (#3402)

* Close: #3398

* error authority is undefined
parent bdc92d5c
...@@ -8,11 +8,12 @@ export const dva = { ...@@ -8,11 +8,12 @@ export const dva = {
}, },
}; };
let authRoutes = null; let authRoutes = {};
function ergodicRoutes(routes, authKey, authority) { function ergodicRoutes(routes, authKey, authority) {
routes.forEach(element => { routes.forEach(element => {
if (element.path === authKey) { if (element.path === authKey) {
if (!element.authority) element.authority = []; // eslint-disable-line
Object.assign(element.authority, authority || []); Object.assign(element.authority, authority || []);
} else if (element.routes) { } else if (element.routes) {
ergodicRoutes(element.routes, authKey, authority); ergodicRoutes(element.routes, authKey, authority);
...@@ -31,8 +32,13 @@ export function patchRoutes(routes) { ...@@ -31,8 +32,13 @@ export function patchRoutes(routes) {
export function render(oldRender) { export function render(oldRender) {
fetch('/api/auth_routes') fetch('/api/auth_routes')
.then(res => res.json()) .then(res => res.json())
.then(ret => { .then(
ret => {
authRoutes = ret; authRoutes = ret;
oldRender(); oldRender();
}); },
() => {
oldRender();
}
);
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment