Skip to content

Commit 12fd4e1

Browse files
committed
add and run prettier
1 parent 1970fe4 commit 12fd4e1

File tree

4 files changed

+27
-14
lines changed

4 files changed

+27
-14
lines changed

.eslintrc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"rules": {
99
"consistent-return": 0,
1010
"react/jsx-one-expression-per-line": 0,
11-
"import/prefer-default-export": 0
11+
"import/prefer-default-export": 0,
12+
"arrow-parens": 0
1213
}
13-
}
14+
}

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"trailingComma": "es5",
3+
"tabWidth": 2,
4+
"semi": true,
5+
"singleQuote": true
6+
}

src/index.js

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,23 @@ export default ({
6161
dispatch({ type: 'init' });
6262

6363
const source = CancelToken.source();
64+
6465
axios({
6566
url,
6667
method,
6768
...options,
6869
cancelToken: source.token,
69-
}).then((response) => {
70-
handler(null, response);
71-
dispatch({ type: 'success', payload: response });
72-
}).catch((error) => {
73-
handler(error, null);
74-
if (!axios.isCancel(error)) {
75-
dispatch({ type: 'fail', payload: error });
76-
}
77-
});
70+
})
71+
.then(response => {
72+
handler(null, response);
73+
dispatch({ type: 'success', payload: response });
74+
})
75+
.catch(error => {
76+
handler(error, null);
77+
if (!axios.isCancel(error)) {
78+
dispatch({ type: 'fail', payload: error });
79+
}
80+
});
7881

7982
return () => {
8083
source.cancel();
@@ -84,7 +87,11 @@ export default ({
8487
return {
8588
...results,
8689
// @deprecated
87-
query: () => { setInnerTrigger(+new Date()); },
88-
reFetch: () => { setInnerTrigger(+new Date()); },
90+
query: () => {
91+
setInnerTrigger(+new Date());
92+
},
93+
reFetch: () => {
94+
setInnerTrigger(+new Date());
95+
},
8996
};
9097
};

src/reducers.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
export const initialResponse = { response: null, error: null, loading: false };
32

43
export function responseReducer(state, action) {

0 commit comments

Comments
 (0)