add modules

This commit is contained in:
Shawn Napora
2019-08-08 10:10:17 -04:00
parent 90d84dbeeb
commit 660b172085
655 changed files with 115589 additions and 21 deletions

View File

@@ -0,0 +1,21 @@
module.exports = authenticationPlugin
const beforeRequest = require('./before-request')
const requestError = require('./request-error')
const validate = require('./validate')
function authenticationPlugin (octokit, options) {
if (!options.auth) {
return
}
validate(options.auth)
const state = {
octokit,
auth: options.auth
}
octokit.hook.before('request', beforeRequest.bind(null, state))
octokit.hook.error('request', requestError.bind(null, state))
}