Created
April 12, 2018 20:21
-
-
Save kvn219/a56e7d5b9360bf3a40d8f59aee1dc52a to your computer and use it in GitHub Desktop.
Fetch data from the github api.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var axios = require('axios'); | |
handleSubmit: function(){ | |
var username = this.usernameRef.value; | |
this.usernameRef.value = ‘’; | |
this.history.pushState(null, “//profile/” + username) | |
} | |
function getRepos(username){ | |
return axios.get('https://api.github.com/users/' + username + '/repos'); | |
} | |
function getUserInfo(username){ | |
return axios.get('https://api.github.com/users/' + username); | |
} | |
function addFile(username, password, data){ | |
var url = 'https://api.github.com/repos/' | |
var userName = 'YOUR_USERNAME' | |
var repoName = 'REPO_NAME' | |
var fileName = 'FILE_NAME' | |
axios.put(urls + userName + repoName + '/contents' + fileName ) | |
} | |
function | |
var helpers = { | |
getGithubInfo: function(username){ | |
return axios.all([getRepos(username), getUserInfo(username)]) | |
.then(function(arr){ | |
return { | |
repos: arr[0].data, | |
bio: arr[1].data | |
} | |
}) | |
} | |
} | |
module.exports = helpers; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment