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.

37 lines
904 B
TypeScript

import { createStore, applyMiddleware } from 'redux';
import { persistStore } from 'redux-persist';
import thunkMiddleware from 'redux-thunk';
import { createLogger } from 'redux-logger';
import promiseMiddleware from './promise-middleware';
import reducers from './reducers';
import { CredentialsType, JournalsType, EntriesType } from './reducers';
export { CredentialsType, CredentialsData, JournalsType, JournalsData, EntriesType, EntriesData } from './reducers';
export interface StoreState {
fetchCount: number;
credentials: CredentialsType;
cache: {
journals: JournalsType;
entries: EntriesType;
};
}
let middleware = [
thunkMiddleware,
promiseMiddleware,
];
if (process.env.NODE_ENV === 'development') {
middleware.push(createLogger());
}
export const store = createStore(
reducers,
applyMiddleware(...middleware)
);
export const persistor = persistStore(store);