Skip to content

Instantly share code, notes, and snippets.

@funkytaco
Forked from overthemike/headerscalls.js
Created October 14, 2017 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save funkytaco/962412288a41a75787b72b7f1f4c2b41 to your computer and use it in GitHub Desktop.
Save funkytaco/962412288a41a75787b72b7f1f4c2b41 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