Skip to content
This repository has been archived by the owner on Jan 2, 2018. It is now read-only.

Commit

Permalink
Made it easier to take ownership over the server entry point
Browse files Browse the repository at this point in the history
This by not having to provide createRoutes and createStore by default.
  • Loading branch information
dlmr committed Oct 13, 2016
1 parent 86b481b commit b07b6aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
9 changes: 1 addition & 8 deletions extensions/roc-package-web-app-react/app/default/server.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
import { createServer, useReact } from '../server';

import getRoutesAndStore from './get-routes-and-store';

const { store, routes } = getRoutesAndStore();

useReact(createServer)({
createRoutes: routes,
createStore: store,
}).start();
useReact(createServer)().start();
9 changes: 8 additions & 1 deletion extensions/roc-package-web-app-react/app/server/useReact.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import useReactLib from 'roc-package-web-app-react/lib/app/server/useReact';

import Header from '../shared/header';
import getRoutesAndStore from '../default/get-routes-and-store';

const { store, routes } = getRoutesAndStore();

export default function useReact(createServer) {
// eslint-disable-next-line
Expand All @@ -13,13 +16,17 @@ export default function useReact(createServer) {
reduxSagas = require(REDUX_SAGAS).default; // eslint-disable-line
}

return useReactLib(createServer, {
return ({ createRoutes = routes, createStore = store, ...rest } = {}) => useReactLib(createServer, {
dev: __DEV__,
dist: __DIST__,
hasTemplateValues: HAS_TEMPLATE_VALUES,
templateValues,
rocPath: ROC_PATH,
Header,
reduxSagas,
})({
createRoutes,
createStore,
...rest,
});
}

0 comments on commit b07b6aa

Please sign in to comment.