如何禁用羽毛钩

时间:2017-06-15 06:56:04

标签: hook feathersjs

我对羽毛很新。有没有办法可以暂时禁用羽毛常见钩子?如果不是,我可以在钩子内调用钩子吗?或者我如何创建条件钩子?

用例:我想为某个service.find操作禁用populate公共钩子,只有那个。

1 个答案:

答案 0 :(得分:3)

Yes, you can call other common-hooks inside a hook. They are pre-made functions and commonly used so the feathers team made them for you. You can create your own if you want, to suit your needs.

You can do something like this.

  unless(
    hook => (falsy condition here),
    populate({ schema: yourSchema }),
  )

There are many ways to do it.

相关问题