Skip to content

Commit 8ffba6a

Browse files
committed
style: format code
1 parent c0efbe0 commit 8ffba6a

File tree

4 files changed

+23
-25
lines changed

4 files changed

+23
-25
lines changed

Diff for: src/api/index.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@ const project = {
1111

1212
const actions = {
1313
http(pName, method, url, data) {
14-
return httpServer({
15-
method: method,
16-
url: url
17-
}, data, ...Object.values(project[pName])).then((res) => {
14+
return httpServer(
15+
{
16+
method: method,
17+
url: url
18+
},
19+
data,
20+
...Object.values(project[pName])
21+
).then(res => {
1822
return res;
1923
});
2024
}
2125
};
2226

23-
export default Object.assign(
24-
actions, demo
25-
);
27+
export default Object.assign(actions, demo);

Diff for: src/pages/index/index.jsx

+4-11
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,18 @@ class IndexPage extends React.Component {
1616

1717
initData() {
1818
const { dispatch } = this.props;
19-
Api.getCnodeList().then((res) => {
19+
Api.getCnodeList().then(res => {
2020
dispatch(Actions.demoList(res));
2121
});
2222
}
2323

2424
render() {
25-
26-
return (
27-
<div className={s.container}>
28-
Hello World
29-
</div>
30-
);
25+
return <div className={s.container}>Hello World</div>;
3126
}
3227
}
3328

34-
const mapStateToProps = (state) => {
35-
return {
36-
37-
};
29+
const mapStateToProps = state => {
30+
return {};
3831
};
3932

4033
export default connect(mapStateToProps)(IndexPage);

Diff for: src/router/index.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const App = () => (
2626
<Router history={history}>
2727
<Switch>
2828
{Routers}
29-
<Redirect from="/" to="/" />
29+
<Redirect from='/' to='/' />
3030
</Switch>
3131
</Router>
3232
);

Diff for: tools/http-server.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* @Author: simbawu
44
* @Date: 2018-11-26 19:01:53
55
* @LastEditors: simbawu
6-
* @LastEditTime: 2019-01-22 20:49:19
76
*/
87
import axios from 'axios';
98

@@ -32,7 +31,7 @@ const interceptorsResponseErr = err => {
3231

3332
// axios 失败重试
3433
const axiosRetry = err => {
35-
let { config, response } = err;
34+
const { config, response } = err;
3635

3736
// retry配置开启检测
3837
if (!config || !config.retry) {
@@ -69,7 +68,7 @@ const axiosRetry = err => {
6968
? (1 / 2) * (Math.pow(2, config.__retryCount) - 1) * config.retryDelay
7069
: 1;
7170

72-
let backoff = new Promise(function(resolve) {
71+
const backoff = new Promise(function(resolve) {
7372
setTimeout(function() {
7473
resolve();
7574
}, backOffDelay);
@@ -100,10 +99,10 @@ const axiosRequest = opts => {
10099

101100
const httpServer = (opts, data, baseURL, token) => {
102101
// 公共参数
103-
let publicOpts = {};
102+
const publicOpts = {};
104103

105104
// http默认配置
106-
let httpDefaultOpts = {
105+
const httpDefaultOpts = {
107106
method: opts.method,
108107
baseURL: baseURL,
109108
url: opts.url,
@@ -117,7 +116,11 @@ const httpServer = (opts, data, baseURL, token) => {
117116
'Content-Type': 'application/json; charset=UTF-8'
118117
},
119118
retry: 3,
120-
retryStatusCodes: [[100, 199], [429, 429], [500, 599]],
119+
retryStatusCodes: [
120+
[100, 199],
121+
[429, 429],
122+
[500, 599]
123+
],
121124
retryDelay: 1000
122125
};
123126

0 commit comments

Comments
 (0)