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.
40 lines
1020 B
TypeScript
40 lines
1020 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 { CredentialsTypeRemote, JournalsType, EntriesType, UserInfoType } from './reducers';
|
|
|
|
export { CredentialsType, CredentialsData, JournalsType, JournalsData,
|
|
EntriesType, EntriesData, UserInfoType, UserInfoData } from './reducers';
|
|
|
|
export interface StoreState {
|
|
fetchCount: number;
|
|
credentials: CredentialsTypeRemote;
|
|
encryptionKey: {key: string};
|
|
cache: {
|
|
journals: JournalsType;
|
|
entries: EntriesType;
|
|
userInfo: UserInfoType;
|
|
};
|
|
}
|
|
|
|
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);
|