Skip to content

Instantly share code, notes, and snippets.

@overthemike
Created August 28, 2017 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save overthemike/eb1d6265a114fcea6d1054aa7ef6553b to your computer and use it in GitHub Desktop.
Save overthemike/eb1d6265a114fcea6d1054aa7ef6553b to your computer and use it in GitHub Desktop.
import axios from 'axios'
function api(user, pass) {
return axios.create({
'X-User':user,
'X-Password':pass
})
}
// later on
const API = api('user2', 'mypassword')
API.get('/endpoint').then(function(data){
console.log(data.results)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment