Skip to content

Commit be4cc67

Browse files
committed
test cases
1 parent dffd377 commit be4cc67

3 files changed

Lines changed: 48 additions & 42 deletions

File tree

package-lock.json

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

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
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",
@@ -20,7 +21,7 @@
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
}

src/actions/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import axios from "axios";
1+
import request from "request-promise";
22

33
const getProductsUri = "https://www.jasonbase.com/things/2MXJ.json";
44

@@ -10,10 +10,10 @@ export const actionType = {
1010
export 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);

0 commit comments

Comments
 (0)