Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #135 from jamesplease/bug-fixies
Browse files Browse the repository at this point in the history
Add ESLint rule to catch unused variable use
  • Loading branch information
jamesplease authored Feb 21, 2018
2 parents 8b0c812 + 8fe517d commit a61c123
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
"rules": {
"no-unused-vars": "error",
"no-use-before-define": "error",
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error"
},
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

### v2.0.2 (2018/2/21)

**Bug Fixes**

* Fixes a bug where an Uncaught ReferenceError could be thrown

### v2.0.1 (2018/2/17)

**Bug Fixes**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-request",
"version": "2.0.1",
"version": "2.0.2",
"description": "Declarative HTTP requests with React.",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
29 changes: 15 additions & 14 deletions src/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,21 @@ export class Fetch extends React.Component {
const uppercaseMethod = method.toUpperCase();
const shouldCacheResponse = this.shouldCacheResponse();

const init = {
body,
credentials,
headers,
method: uppercaseMethod,
mode,
cache,
redirect,
referrer,
referrerPolicy,
integrity,
keepalive,
signal
};

const responseReceivedInfo = {
url,
init,
Expand Down Expand Up @@ -221,20 +236,6 @@ export class Fetch extends React.Component {
return Promise.resolve(cacheError);
}
}
const init = {
body,
credentials,
headers,
method: uppercaseMethod,
mode,
cache,
redirect,
referrer,
referrerPolicy,
integrity,
keepalive,
signal
};

this.setState({
fetching: true,
Expand Down

0 comments on commit a61c123

Please sign in to comment.