Перья js - настройте пример полезной нагрузки - PullRequest
0 голосов
/ 04 мая 2020

Здравствуйте, я только что обнаружил Перья js, и я в процессе следования полному примеру на https://vuex.feathersjs.com/common-patterns.html#full -nuxt-example 'моем вопросе и следующем, как мы можем расширить AuthenticationService с новыми данными, указанными в do c 'https://docs.feathersjs.com/cookbook/authentication/stateless.html#customizing -the-payload ', это класс расширения, который мне нужен:

const { AuthenticationService } = require('@feathersjs/authentication');

class MyAuthService extends AuthenticationService {
  async getPayload(authResult, params) {
    // Call original `getPayload` first
    const payload = await super.getPayload(authResult, params);
    const { user } = authResult;

    if (user && user.permissions) {
      payload.permissions = user.permissions;
    }

    return payload;
  }
}
app.use('/authentication', new MyAuthService(app));

здесь

спасибо

...