Begin move to redux
This commit is contained in:
3
src/redux/actions/mount_actions.js
Normal file
3
src/redux/actions/mount_actions.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import {createAction} from "redux-starter-kit";
|
||||
|
||||
export const setBusy = createAction('mounts/setBusy');
|
||||
10
src/redux/reducers/mount_reducer.js
Normal file
10
src/redux/reducers/mount_reducer.js
Normal 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};
|
||||
}
|
||||
});
|
||||
17
src/redux/store/createAppStore.js
Normal file
17
src/redux/store/createAppStore.js
Normal 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
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user