-
Notifications
You must be signed in to change notification settings - Fork 0
/
redux.js
31 lines (24 loc) · 1006 Bytes
/
redux.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var assign, auth, getModuleExports, redux, router, thunk;
assign = require("lodash.assign");
auth = require("./auth");
getModuleExports = require("./get-module-exports");
redux = require("redux");
router = require("./router");
thunk = require("redux-thunk");
module.exports = {
init: function(actionsAndReducers) {
var devTools, middlewares;
devTools = (typeof window !== "undefined" && window !== null ? typeof window.devToolsExtension === "function" ? window.devToolsExtension() : void 0 : void 0) || function(f) {
return f;
};
middlewares = redux.compose(redux.applyMiddleware(thunk["default"]), devTools);
this.actions = assign({}, getModuleExports(actionsAndReducers, "actions"), {
auth: auth.actions
});
this.reducer = redux.combineReducers(assign({}, getModuleExports(actionsAndReducers, "reducer"), {
auth: auth.reducer,
route: router.reducer
}));
return this.store = redux.createStore(this.reducer, void 0, middlewares);
}
};