Fix store already initialized error.
This commit is contained in:
parent
7afb07328f
commit
9599f197e9
2 changed files with 17 additions and 19 deletions
|
|
@ -9,22 +9,20 @@ import pendingCompose from './reducers/pendingCompose';
|
|||
let registry;
|
||||
|
||||
export function init (store = {}, ...middleware) {
|
||||
if (registry) {
|
||||
throw new Error('store already initialized');
|
||||
if (!registry) {
|
||||
registry = new ReducerRegistry(store, [
|
||||
promiseMiddleware,
|
||||
thunk,
|
||||
...middleware
|
||||
]);
|
||||
|
||||
registry.register({
|
||||
composes,
|
||||
pendingCompose,
|
||||
notifications: notificationsReducer,
|
||||
});
|
||||
}
|
||||
|
||||
registry = new ReducerRegistry(store, [
|
||||
promiseMiddleware,
|
||||
thunk,
|
||||
...middleware
|
||||
]);
|
||||
|
||||
registry.register({
|
||||
composes,
|
||||
pendingCompose,
|
||||
notifications: notificationsReducer,
|
||||
});
|
||||
|
||||
return registry;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue