Skip to content

Commit 124ff14

Browse files
committed
merged redux and miko branch
1 parent 9362366 commit 124ff14

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

app/src/index.js

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ import {
77
} from 'react-router-dom';
88
import 'babel-polyfill';
99
import React from 'react';
10-
import store from './redux/store';
10+
import reduxStore from './redux/store';
1111
import { Provider } from 'react-redux';
12+
import { createStore } from 'redux';
1213
import ReactDOM from 'react-dom';
1314
import Cookies from 'js-cookie';
1415
import App from './components/App.tsx';
@@ -23,22 +24,22 @@ const client = new ApolloClient({
2324
uri: 'https://reactype-caret.herokuapp.com/graphql',
2425
cache: new InMemoryCache()
2526
});
26-
// const initialState = { code: ``, input: `` };
27-
// const rootReducer = (state = initialState, action) => {
28-
// switch (action.type) {
29-
// case 'SAVE':
30-
// return { ...state, code: action.payload };
31-
// case 'INPUT':
32-
// return { ...state, input: action.payload };
33-
// default:
34-
// return state;
35-
// }
36-
// };
27+
const initialState = { code: ``, input: `` };
28+
const rootReducer = (state = initialState, action) => {
29+
switch (action.type) {
30+
case 'SAVE':
31+
return { ...state, code: action.payload };
32+
case 'INPUT':
33+
return { ...state, input: action.payload };
34+
default:
35+
return state;
36+
}
37+
};
3738

38-
// export const store = createStore(
39-
// rootReducer,
40-
// window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
41-
// );
39+
export const store = createStore(
40+
rootReducer,
41+
window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
42+
);
4243

4344
const PrivateRoute = ({ component: Component, ...rest }) => (
4445
<Route
@@ -55,7 +56,7 @@ const PrivateRoute = ({ component: Component, ...rest }) => (
5556

5657
ReactDOM.render(
5758
<ApolloProvider client={client}>
58-
<Provider store={store}>
59+
<Provider store={reduxStore}>
5960
<Router>
6061
<Switch>
6162
<Route exact path="/login" component={SignIn} />

0 commit comments

Comments
 (0)