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.
|
|
|
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 { CredentialsTypeRemote, JournalsType, EntriesType } from './reducers';
|
|
|
|
|
|
|
|
export { CredentialsType, CredentialsData, JournalsType, JournalsData, EntriesType, EntriesData } from './reducers';
|
|
|
|
|
|
|
|
export interface StoreState {
|
|
|
|
fetchCount: number;
|
|
|
|
credentials: CredentialsTypeRemote;
|
|
|
|
encryptionKey: {key: string};
|
|
|
|
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);
|