1 | import Debug from 'debug';
|
2 | import { HookContext } from '@feathersjs/feathers';
|
3 | import { ConnectionEvent } from '../core';
|
4 |
|
5 | const debug = Debug('@feathersjs/authentication/hooks/connection');
|
6 |
|
7 | export default (event: ConnectionEvent) => async (context: HookContext) => {
|
8 | const { app, result, params } = context;
|
9 |
|
10 | if (params.provider && result) {
|
11 | debug(`Sending authentication event '${event}'`);
|
12 | app.emit(event, result, params, context);
|
13 | }
|
14 |
|
15 | return context;
|
16 | };
|