From 5a9d3c079c183357757111e807ffa5b11087250e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=8F=E8=81=AA?= Date: Thu, 17 Jan 2019 14:40:41 +0800 Subject: [PATCH] fix: error-processing-request (#3402) * Close: #3398 * error authority is undefined --- src/app.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/app.js b/src/app.js index 7de5a69e..0f35ff9a 100644 --- a/src/app.js +++ b/src/app.js @@ -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(); + } + ); } -- GitLab