Skip to content

Commit d5745b4

Browse files
peterblazejewiczluisrudge
authored andcommitted
💄 refactor handleAuthentication definition (#56)
This commit removes the second parameter of the handleAuthentication method, as it is never used and refactor the first argument to use ES6 destructuring for clear description of what is the subject of the method implementation. The nextState has been replaced with location object directly as the subject of the method check Thanks!
1 parent 588751d commit d5745b4

5 files changed

Lines changed: 10 additions & 10 deletions

File tree

01-Login/src/routes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import history from './history';
88

99
const auth = new Auth();
1010

11-
const handleAuthentication = (nextState, replace) => {
12-
if (/access_token|id_token|error/.test(nextState.location.hash)) {
11+
const handleAuthentication = ({location}) => {
12+
if (/access_token|id_token|error/.test(location.hash)) {
1313
auth.handleAuthentication();
1414
}
1515
}

02-User-Profile/src/routes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import history from './history';
99

1010
const auth = new Auth();
1111

12-
const handleAuthentication = (nextState, replace) => {
13-
if (/access_token|id_token|error/.test(nextState.location.hash)) {
12+
const handleAuthentication = ({location}) => {
13+
if (/access_token|id_token|error/.test(location.hash)) {
1414
auth.handleAuthentication();
1515
}
1616
}

03-Calling-an-API/src/routes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import history from './history';
1010

1111
const auth = new Auth();
1212

13-
const handleAuthentication = (nextState, replace) => {
14-
if (/access_token|id_token|error/.test(nextState.location.hash)) {
13+
const handleAuthentication = ({location}) => {
14+
if (/access_token|id_token|error/.test(location.hash)) {
1515
auth.handleAuthentication();
1616
}
1717
}

04-Authorization/src/routes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import history from './history';
1111

1212
const auth = new Auth();
1313

14-
const handleAuthentication = (nextState, replace) => {
15-
if (/access_token|id_token|error/.test(nextState.location.hash)) {
14+
const handleAuthentication = ({location}) => {
15+
if (/access_token|id_token|error/.test(location.hash)) {
1616
auth.handleAuthentication();
1717
}
1818
}

05-Token-Renewal/src/routes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import history from './history';
99

1010
const auth = new Auth();
1111

12-
const handleAuthentication = (nextState, replace) => {
13-
if (/access_token|id_token|error/.test(nextState.location.hash)) {
12+
const handleAuthentication = ({location}) => {
13+
if (/access_token|id_token|error/.test(location.hash)) {
1414
auth.handleAuthentication();
1515
}
1616
};

0 commit comments

Comments
 (0)