Created
August 28, 2017 22:54
-
-
Save overthemike/eb1d6265a114fcea6d1054aa7ef6553b to your computer and use it in GitHub Desktop.
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
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