zcash-grant-system/frontend/client/store/reducers.tsx

40 lines
1.2 KiB
TypeScript
Raw Normal View History

import { combineReducers, Reducer } from 'redux';
2018-11-13 08:07:09 -08:00
import { connectRouter, RouterState } from 'connected-react-router';
import { persistReducer } from 'redux-persist';
2018-09-10 09:55:26 -07:00
import proposal, {
ProposalState,
INITIAL_STATE as proposalInitialState,
} from 'modules/proposals';
import create, { CreateState, INITIAL_STATE as createInitialState } from 'modules/create';
import authReducer, {
AuthState,
INITIAL_STATE as authInitialState,
authPersistConfig,
} from 'modules/auth';
import users, { UsersState, INITIAL_STATE as usersInitialState } from 'modules/users';
2018-11-13 08:07:09 -08:00
import history from './history';
2018-09-10 09:55:26 -07:00
export interface AppState {
proposal: ProposalState;
create: CreateState;
users: UsersState;
auth: AuthState;
2018-11-13 08:07:09 -08:00
router: RouterState;
2018-09-10 09:55:26 -07:00
}
2018-11-13 08:07:09 -08:00
export const combineInitialState: Partial<AppState> = {
2018-09-10 09:55:26 -07:00
proposal: proposalInitialState,
create: createInitialState,
users: usersInitialState,
auth: authInitialState,
2018-09-10 09:55:26 -07:00
};
export default combineReducers<AppState>({
proposal,
create,
users,
// Don't allow for redux-persist's _persist key to be touched in our code
auth: (persistReducer(authPersistConfig, authReducer) as any) as Reducer<AuthState>,
2018-11-13 08:07:09 -08:00
router: connectRouter(history),
2018-09-10 09:55:26 -07:00
});