-
-
Save agungid/48abd57eb8c55355834e14f38c9d842e to your computer and use it in GitHub Desktop.
Contoh penggunaan custom hook di feathersjs
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
// Use this hook to manipulate incoming or outgoing data. | |
// For more information on hooks see: http://docs.feathersjs.com/api/hooks.html | |
// get data email and access token from github Oauth | |
module.exports = function (options = {}) { // eslint-disable-line no-unused-vars | |
return function userGithub (hook) { | |
if (hook.data.github) { | |
hook.data.email = hook.data.github.profile.emails[0].value; | |
hook.data.accessToken = hook.data.github.accessToken; | |
} | |
return Promise.resolve(hook); | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment