From 7e2500c713e02757fbcf57b59a8c33ffecc62010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B0=8F=E8=81=AA?= Date: Wed, 10 Apr 2019 09:31:37 +0800 Subject: [PATCH] remove serve authRoutes (#3946) --- mock/route.js | 5 ----- src/app.js | 35 +---------------------------------- 2 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 mock/route.js diff --git a/mock/route.js b/mock/route.js deleted file mode 100644 index 418d10f1..00000000 --- a/mock/route.js +++ /dev/null @@ -1,5 +0,0 @@ -export default { - '/api/auth_routes': { - '/form/advanced-form': { authority: ['admin', 'user'] }, - }, -}; diff --git a/src/app.js b/src/app.js index 0f35ff9a..2e98b22b 100644 --- a/src/app.js +++ b/src/app.js @@ -1,5 +1,3 @@ -import fetch from 'dva/fetch'; - export const dva = { config: { onError(err) { @@ -8,37 +6,6 @@ export const dva = { }, }; -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); - } - return element; - }); -} - -export function patchRoutes(routes) { - Object.keys(authRoutes).map(authKey => - ergodicRoutes(routes, authKey, authRoutes[authKey].authority) - ); - window.g_routes = routes; -} - export function render(oldRender) { - fetch('/api/auth_routes') - .then(res => res.json()) - .then( - ret => { - authRoutes = ret; - oldRender(); - }, - () => { - oldRender(); - } - ); + oldRender(); } -- GitLab