1 | import { HookContext } from '@feathersjs/feathers';
|
2 | import omit from 'lodash/omit';
|
3 | import { AuthenticationBase, ConnectionEvent } from '../core';
|
4 |
|
5 | export default (event: ConnectionEvent) => async (context: HookContext) => {
|
6 | const { result, params: { connection } } = context;
|
7 |
|
8 | if (!connection) {
|
9 | return context;
|
10 | }
|
11 |
|
12 | const service = context.service as unknown as AuthenticationBase;
|
13 |
|
14 | Object.assign(connection, omit(result, 'accessToken', 'authentication'));
|
15 |
|
16 | await service.handleConnection(event, connection, result);
|
17 |
|
18 | return context;
|
19 | };
|