File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " mystore" ,
3- "version" : " 0.1 .0" ,
3+ "version" : " 0.2 .0" ,
44 "private" : true ,
55 "dependencies" : {
6- "axios" : " ^0.17.0" ,
7- "react" : " ^16.0.0" ,
8- "react-dom" : " ^16.0.0" ,
6+ "react" : " ^16.1.1" ,
7+ "react-dom" : " ^16.1.1" ,
98 "react-redux" : " ^5.0.6" ,
109 "react-router-dom" : " ^4.2.2" ,
1110 "react-scripts" : " 1.0.14" ,
1211 "redux" : " ^3.7.2" ,
13- "redux-thunk" : " ^2.2.0"
12+ "redux-thunk" : " ^2.2.0" ,
13+ "request" : " ^2.83.0" ,
14+ "request-promise" : " ^4.2.2"
1415 },
1516 "scripts" : {
1617 "start" : " react-scripts start" ,
2021 "deploy" : " npm run build&&gh-pages -d build"
2122 },
2223 "devDependencies" : {
23- "gh-pages" : " ^1.0 .0"
24+ "gh-pages" : " ^1.1 .0"
2425 },
2526 "homepage" : " https://ghdna.github.io/reactjs-estore"
2627}
Original file line number Diff line number Diff line change 1- import axios from "axios " ;
1+ import request from "request-promise " ;
22
33const getProductsUri = "https://www.jasonbase.com/things/2MXJ.json" ;
44
@@ -10,10 +10,10 @@ export const actionType = {
1010export function getProducts ( params ) {
1111 return async dispatch => {
1212 try {
13- const request = await axios . get ( getProductsUri ) ;
13+ const response = await request . get ( getProductsUri ) ;
1414 dispatch ( {
1515 type : actionType . GET_PRODUCTS ,
16- payload : request . data
16+ payload : JSON . parse ( response )
1717 } ) ;
1818 } catch ( e ) {
1919 console . error ( e ) ;
You can’t perform that action at this time.
0 commit comments