Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw errors for deprecated hooks and update documentation #134

Closed
petermikitsh opened this Issue Mar 28, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@petermikitsh
Copy link
Contributor

petermikitsh commented Mar 28, 2016

I was running into vague errors when I began adding authentication hooks, e.g.,

.../services/signature/hooks.js:44
sAuthentication.hooks.populateUser(), _feathersAuthentication.hooks.requireAut
                                                                    ^
TypeError: undefined is not a function
    at Object.<anonymous> (hooks.js:43:15)
    at Module._compile (module.js:460:26)

because I was requiring a deprecated hook:

import { hooks as authHooks } from 'feathers-authentication';

exports.before = {
  create: [
    ...
    authHooks.requireAuth(), // bad
    ...
  ]
}

when I really wanted this:

import { hooks as authHooks } from 'feathers-authentication';

exports.before = {
  create: [
    ...
    authHooks.restrictToAuthenticated(), // good
    ...
  ]
}

Then I saw the new documentation in the README which helped me out, but a clearer message in the console would be preferred. The authentication hooks documentation references the deprecated names.

@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Mar 28, 2016

Sorry yes we haven't gotten around to updating the docs just yet. Some new fixes are going in first to avoid doing work twice. Related to #129.

@ekryski ekryski added this to the 0.7 milestone Mar 28, 2016

@ekryski ekryski closed this Mar 30, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.