You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
511 B
TypeScript
29 lines
511 B
TypeScript
import thunk from 'redux-thunk';
|
|
import {
|
|
createStore,
|
|
applyMiddleware,
|
|
Store,
|
|
Reducer,
|
|
} from 'redux';
|
|
|
|
const middlewares = [
|
|
thunk,
|
|
];
|
|
|
|
let store: Store | null = null;
|
|
|
|
export default function createCVATStore(createRootReducer: () => Reducer): void {
|
|
store = createStore(
|
|
createRootReducer(),
|
|
applyMiddleware(...middlewares),
|
|
);
|
|
}
|
|
|
|
export function getCVATStore(): Store {
|
|
if (store) {
|
|
return store;
|
|
}
|
|
|
|
throw new Error('First create a store');
|
|
}
|