Forráskód Böngészése

remove serve authRoutes (#3946)

陈小聪 6 éve
szülő
commit
7e2500c713
2 módosított fájl, 1 hozzáadás és 39 törlés
  1. 0 5
      mock/route.js
  2. 1 34
      src/app.js

+ 0 - 5
mock/route.js

@@ -1,5 +0,0 @@
-export default {
-  '/api/auth_routes': {
-    '/form/advanced-form': { authority: ['admin', 'user'] },
-  },
-};

+ 1 - 34
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();
 }