无论如何,我们可以阻止该挂钩将其保存到feather js中的集合中吗?

问题描述 投票:0回答:1

我想在羽毛的前钩子上创建一个过滤器。我想检查数据是否包含此参数,然后不要将此数据保存在集合中。羽毛有可能吗?

javascript feathersjs
1个回答
1
投票

这可以通过在context.result挂钩中设置before来完成。也可以找到更多详细信息in the hooks API

app.service('users').hooks({
  before: {
    get: [
      context => {
        // Never call the actual users service
        // just use the authenticated user
        context.result = context.params.user;

        return context;
      }
    ]
  }
});
© www.soinside.com 2019 - 2024. All rights reserved.