Skip to content

Commit

Permalink
fix fetch json parse
Browse files Browse the repository at this point in the history
  • Loading branch information
pjblitz86 committed Jan 22, 2019
1 parent 98b5c67 commit f69a6a3
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions client/src/components/profile/ProfileGithub.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@ class ProfileGithub extends Component {
const { username } = this.props;
const { count, sort, clientId, clientSecret } = this.state;

fetch(`https:/api.github.com/users/${username}/repos?per_page=${count}&sort=${sort}&client_id=${clientId}&client_secret=${clientSecret}`, {
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
})
.then(res => res.json())
fetch(`https:/api.github.com/users/${username}/repos?per_page=${count}&sort=${sort}&client_id=${clientId}&client_secret=${clientSecret}`)
.then(res => res.text())
.then(text => JSON.parse(text))
.then(data => {
if (this.refs.myRef) {
this.setState({ repos: data })
Expand Down

0 comments on commit f69a6a3

Please sign in to comment.