Skip to content

Commit

Permalink
Amend getUser Function to give fetch request an authorisation header,…
Browse files Browse the repository at this point in the history
… rather than a parameter (deprecated).

Relates #35.

Co-authored-by: HannahGooding <[email protected]>
  • Loading branch information
HettieM and hannahgooding committed May 8, 2020
1 parent 0d906ac commit 3a14723
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
9 changes: 0 additions & 9 deletions src/App.test.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const Header = () => {
<option value="Albadylic">Gregor</option>
<option value="hannahgooding">Hannah</option>
<option value="HettieM">Hettie</option>
<option value="Ivo-Evans">Ivo</option>w{" "}
<option value="Ivo-Evans">Ivo</option>
<option value="itsina96">Ina</option>
<option value="jackherizsmith">Jack</option>
<option value="jamesj-0">James</option>
Expand Down
6 changes: 3 additions & 3 deletions src/utils/getUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ const checkResponse = (response) => {
};

const getUser = (username) => {
return fetch(
`https://api.github.com/users/${username}?access_token=${accessToken}`
)
return fetch(`https://api.github.com/users/${username}?`, {
Authorization: `token ${accessToken}`,
})
.then(checkResponse)
.catch((error) => {
throw new Error(`Fetch getUserData failed ${error}`);
Expand Down

0 comments on commit 3a14723

Please sign in to comment.