Created
July 9, 2017 18:48
-
-
Save dbouwman/a077bcd28522a1b195629b8f359d7622 to your computer and use it in GitHub Desktop.
bits and pieces
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
/** | |
* Given a username and password, make a https request for a token | |
*/ | |
getToken (username, password, portalBaseUrl) { | |
const url = `${portalBaseUrl}/sharing/rest/generateToken?f=json`; | |
let options = { | |
method: 'POST', | |
form: { | |
username: username, | |
password: password, | |
referer: portalBaseUrl | |
}, | |
json: true | |
}; | |
// fire the request | |
return request.post(url, options); | |
} |
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
/** | |
* Proxy to the fetch that is imported during the build process | |
*/ | |
fetch (url, options) { | |
return fetch(url, options); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment