Skip to content

Commit 92722b9

Browse files
author
David Silva
committed
Added redux-json-api with temp base Url
1 parent a7eed71 commit 92722b9

File tree

5 files changed

+149
-10
lines changed

5 files changed

+149
-10
lines changed

package-lock.json

Lines changed: 135 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"babel-eslint": "7.2.3",
2323
"babel-jest": "20.0.3",
2424
"babel-loader": "7.1.2",
25+
"babel-polyfill": "^6.26.0",
2526
"babel-preset-react-app": "^3.1.0",
2627
"babel-runtime": "6.26.0",
2728
"case-sensitive-paths-webpack-plugin": "2.1.1",
@@ -51,6 +52,7 @@
5152
"react-router-prop-types": "0.0.2",
5253
"react-router-redux": "next",
5354
"redux": "^3.7.2",
55+
"redux-json-api": "^2.0.0-beta.4",
5456
"redux-thunk": "^2.2.0",
5557
"sanitize.css": "^5.0.0",
5658
"style-loader": "0.19.0",

src/containers/home/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,8 @@ class Home extends React.Component {
4242
}
4343
}
4444

45-
const mapStateToProps = state => ({
46-
count: state.counter.count,
47-
isIncrementing: state.counter.isIncrementing,
48-
isDecrementing: state.counter.isDecrementing
45+
const mapStateToProps = () => ({
46+
4947
});
5048

5149
const mapDispatchToProps = dispatch => bindActionCreators({

src/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,21 @@ import { render } from 'react-dom';
33
import { Provider } from 'react-redux';
44
import { ConnectedRouter } from 'react-router-redux';
55
import store, { history } from './store';
6+
import { setAxiosConfig } from 'redux-json-api';
67
import App from './containers/app';
78

89
import 'sanitize.css/sanitize.css';
910
import './styles/main.scss';
1011

1112
const target = document.querySelector('#root');
1213

14+
store.dispatch(setAxiosConfig({
15+
baseURL: 'http://localhost:9500/api',
16+
headers: {
17+
'Content-Type': 'application/json',
18+
},
19+
}));
20+
1321
render(
1422
<Provider store={store}>
1523
<ConnectedRouter history={history}>

src/modules/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { combineReducers } from 'redux';
22
import { routerReducer } from 'react-router-redux';
3-
import counter from './counter';
3+
import { reducer as api } from 'redux-json-api';
44

55
export default combineReducers({
66
router: routerReducer,
7-
counter
7+
api,
88
});

0 commit comments

Comments
 (0)