UNPKG

463 BPlain TextView Raw
1import { HookContext, NextFunction } from '@feathersjs/feathers'
2import { AuthenticationBase, ConnectionEvent } from '../core'
3
4export default (event: ConnectionEvent) => async (context: HookContext, next: NextFunction) => {
5 await next()
6
7 const {
8 result,
9 params: { connection }
10 } = context
11
12 if (connection) {
13 const service = context.service as unknown as AuthenticationBase
14
15 await service.handleConnection(event, connection, result)
16 }
17}