Skip to content

Commit

Permalink
fix: error-processing-request (ant-design#3402)
Browse files Browse the repository at this point in the history
* Close: ant-design#3398

* error authority is undefined
  • Loading branch information
xiaohuoni authored Jan 17, 2019
1 parent bdc92d5 commit 5a9d3c0
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
}
);
}

0 comments on commit 5a9d3c0

Please sign in to comment.