mirror of
https://github.com/tlsnotary/tlsn-plugin-demo.git
synced 2026-01-08 04:54:07 -05:00
30 lines
767 B
TypeScript
30 lines
767 B
TypeScript
import { applyMiddleware, combineReducers, createStore } from 'redux';
|
|
import thunk from 'redux-thunk';
|
|
import { createLogger } from 'redux-logger';
|
|
import attestation from './attestation';
|
|
|
|
const rootReducer = combineReducers({
|
|
attestation,
|
|
});
|
|
|
|
export type AppRootState = ReturnType<typeof rootReducer>;
|
|
|
|
const createStoreWithMiddleware =
|
|
process.env.NODE_ENV === 'development'
|
|
? applyMiddleware(
|
|
thunk,
|
|
createLogger({
|
|
collapsed: true,
|
|
}),
|
|
)(createStore)
|
|
: applyMiddleware(thunk)(createStore);
|
|
|
|
function configureAppStore(preloadedState?: AppRootState) {
|
|
const { attestation } = preloadedState || {};
|
|
return createStoreWithMiddleware(rootReducer, {
|
|
attestation,
|
|
});
|
|
}
|
|
|
|
export default configureAppStore;
|