-
-
Save funkytaco/d021a9c0fb553af4b759d10abb6b7ddb to your computer and use it in GitHub Desktop.
This file contains hidden or 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