Add jobs behind beta flag
This commit is contained in:
		@@ -11,17 +11,26 @@ const debug = debugFactory('freecc:react-server');
 | 
				
			|||||||
// add routes here as they slowly get reactified
 | 
					// add routes here as they slowly get reactified
 | 
				
			||||||
// remove their individual controllers
 | 
					// remove their individual controllers
 | 
				
			||||||
const routes = [
 | 
					const routes = [
 | 
				
			||||||
  '/hikes',
 | 
					 | 
				
			||||||
  '/hikes/*',
 | 
					 | 
				
			||||||
  '/jobs',
 | 
					  '/jobs',
 | 
				
			||||||
  '/jobs/*'
 | 
					  '/jobs/*'
 | 
				
			||||||
];
 | 
					];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const devRoutes = [
 | 
				
			||||||
 | 
					  '/hikes',
 | 
				
			||||||
 | 
					  '/hikes/*'
 | 
				
			||||||
 | 
					];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default function reactSubRouter(app) {
 | 
					export default function reactSubRouter(app) {
 | 
				
			||||||
  var router = app.loopback.Router();
 | 
					  var router = app.loopback.Router();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (process.env.BETA) {
 | 
				
			||||||
 | 
					    routes.forEach((route) => {
 | 
				
			||||||
 | 
					      router.get(route, serveReactApp);
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (process.env.NODE_ENV === 'development') {
 | 
					  if (process.env.NODE_ENV === 'development') {
 | 
				
			||||||
    routes.forEach(function(route) {
 | 
					    devRoutes.forEach(function(route) {
 | 
				
			||||||
      router.get(route, serveReactApp);
 | 
					      router.get(route, serveReactApp);
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -35,8 +44,7 @@ export default function reactSubRouter(app) {
 | 
				
			|||||||
    // returns a router wrapped app
 | 
					    // returns a router wrapped app
 | 
				
			||||||
    app$({ location })
 | 
					    app$({ location })
 | 
				
			||||||
      // if react-router does not find a route send down the chain
 | 
					      // if react-router does not find a route send down the chain
 | 
				
			||||||
      .filter(function({ props, nextLocation }) {
 | 
					      .filter(function({ props }) {
 | 
				
			||||||
        console.log('foo', nextLocation);
 | 
					 | 
				
			||||||
        if (!props) {
 | 
					        if (!props) {
 | 
				
			||||||
          debug('react tried to find %s but got 404', location.pathname);
 | 
					          debug('react tried to find %s but got 404', location.pathname);
 | 
				
			||||||
          return next();
 | 
					          return next();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user