Skip to content

Instantly share code, notes, and snippets.

@agungid
Last active September 27, 2017 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agungid/48abd57eb8c55355834e14f38c9d842e to your computer and use it in GitHub Desktop.
Save agungid/48abd57eb8c55355834e14f38c9d842e to your computer and use it in GitHub Desktop.
Contoh penggunaan custom hook di feathersjs
// 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