Begin move to redux

This commit is contained in:
Scott E. Graves
2019-06-04 22:08:21 -05:00
parent a5e21c8dfc
commit fc48c9c0db
7 changed files with 64 additions and 14 deletions

View File

@@ -0,0 +1,3 @@
import {createAction} from "redux-starter-kit";
export const setBusy = createAction('mounts/setBusy');

View File

@@ -0,0 +1,10 @@
import {createReducer} from 'redux-starter-kit';
import {setBusy} from '../actions/mount_actions';
export const mountReducer = createReducer({
MountsBusy: false,
}, {
[setBusy]: (state, action) => {
return {...state, MountsBusy: action.payload};
}
});

View File

@@ -0,0 +1,17 @@
import { configureStore, getDefaultMiddleware } from 'redux-starter-kit';
import {mountReducer} from '../reducers/mount_reducer';
export default function createAppStore(preloadedState) {
const reducer = {
mounts: mountReducer,
};
const middleware = [...getDefaultMiddleware()];
return configureStore({
reducer,
middleware,
devTools: process.env.NODE_ENV !== 'production',
preloadedState
});
}